summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Willden <swillden@google.com>2015-04-17 00:21:01 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-04-17 00:21:01 +0000
commit0af1e38cbd2584abaa3daa5d4b4e33f7f39cfb3b (patch)
tree232338fec5a95af3584ad48b2982a7c279bcd470
parent57430977cf7b758a4fe955933e32c5d2d44574b2 (diff)
parent8e6b64cb30309a61730523c5dd6428aae763a73b (diff)
downloadandroid_system_security-0af1e38cbd2584abaa3daa5d4b4e33f7f39cfb3b.tar.gz
android_system_security-0af1e38cbd2584abaa3daa5d4b4e33f7f39cfb3b.tar.bz2
android_system_security-0af1e38cbd2584abaa3daa5d4b4e33f7f39cfb3b.zip
am 8e6b64cb: am ef76546c: am 28befb5e: Merge "Add test for AuthTokenTable.Clear."
* commit '8e6b64cb30309a61730523c5dd6428aae763a73b': 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);