summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Willden <swillden@google.com>2015-04-17 00:14:37 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-04-17 00:14:37 +0000
commit8e6b64cb30309a61730523c5dd6428aae763a73b (patch)
tree73133708fd460e6606f69140dde5b6b8fdf36428
parentc598fab3ae8e363f84e2d6f41dd6511e27df240f (diff)
parentef76546ca43a6a46e477ed9d93dd2421603527fe (diff)
downloadandroid_system_security-8e6b64cb30309a61730523c5dd6428aae763a73b.tar.gz
android_system_security-8e6b64cb30309a61730523c5dd6428aae763a73b.tar.bz2
android_system_security-8e6b64cb30309a61730523c5dd6428aae763a73b.zip
am ef76546c: am 28befb5e: Merge "Add test for AuthTokenTable.Clear."
* commit 'ef76546ca43a6a46e477ed9d93dd2421603527fe': Add test for AuthTokenTable.Clear.
-rw-r--r--keystore/tests/auth_token_table_test.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/keystore/tests/auth_token_table_test.cpp b/keystore/tests/auth_token_table_test.cpp
index 0f74e77..fec7e43 100644
--- a/keystore/tests/auth_token_table_test.cpp
+++ b/keystore/tests/auth_token_table_test.cpp
@@ -72,7 +72,7 @@ TEST(AuthTokenTableTest, Create) {
}
static hw_auth_token_t* make_token(uint64_t rsid, uint64_t ssid = 0, uint64_t challenge = 0,
- uint32_t timestamp = 0) {
+ uint64_t timestamp = 0) {
hw_auth_token_t* token = new hw_auth_token_t;
token->user_id = rsid;
token->authenticator_id = ssid;
@@ -129,6 +129,25 @@ TEST(AuthTokenTableTest, SimpleAddAndFindTokens) {
table.FindAuthorization(make_set(5), 0, &found));
}
+TEST(AuthTokenTableTest, FlushTable) {
+ AuthTokenTable table(3, monotonic_clock);
+
+ table.AddAuthenticationToken(make_token(1));
+ table.AddAuthenticationToken(make_token(2));
+ table.AddAuthenticationToken(make_token(3));
+
+ const hw_auth_token_t* found;
+
+ // All three should be in the table.
+ EXPECT_EQ(3U, table.size());
+ EXPECT_EQ(AuthTokenTable::OK, table.FindAuthorization(make_set(1), 0, &found));
+ EXPECT_EQ(AuthTokenTable::OK, table.FindAuthorization(make_set(2), 0, &found));
+ EXPECT_EQ(AuthTokenTable::OK, table.FindAuthorization(make_set(3), 0, &found));
+
+ table.Clear();
+ EXPECT_EQ(0U, table.size());
+}
+
TEST(AuthTokenTableTest, TableOverflow) {
AuthTokenTable table(3, monotonic_clock);