Index: components/gcm_driver/crypto/gcm_key_store_unittest.cc |
diff --git a/components/gcm_driver/crypto/gcm_key_store_unittest.cc b/components/gcm_driver/crypto/gcm_key_store_unittest.cc |
index 067bad47c87a87a512f57d84480194bc02b5cc8c..114f7f30a56702f4cca7703c4b0e6d6915147f97 100644 |
--- a/components/gcm_driver/crypto/gcm_key_store_unittest.cc |
+++ b/components/gcm_driver/crypto/gcm_key_store_unittest.cc |
@@ -211,6 +211,37 @@ TEST_F(GCMKeyStoreTest, CreateAndRemoveKeys) { |
ASSERT_FALSE(read_pair.IsInitialized()); |
} |
+TEST_F(GCMKeyStoreTest, CreateAndRemoveKeysSynchronously) { |
+ KeyPair pair; |
+ std::string auth_secret; |
+ gcm_key_store()->CreateKeys(kFakeAppId, |
+ base::Bind(&GCMKeyStoreTest::GotKeys, |
+ base::Unretained(this), &pair, |
+ &auth_secret)); |
+ |
+ // Continue synchronously, without running RunUntilIdle first. |
+ gcm_key_store()->RemoveKeys(kFakeAppId, base::Bind(&base::DoNothing)); |
+ |
+ base::RunLoop().RunUntilIdle(); |
+ |
+ ASSERT_TRUE(pair.IsInitialized()); |
+ EXPECT_TRUE(pair.has_type()); |
+ |
+ histogram_tester()->ExpectBucketCount( |
+ "GCM.Crypto.RemoveKeySuccessRate", 1, 1); // success |
+ |
+ KeyPair read_pair; |
+ std::string read_auth_secret; |
+ gcm_key_store()->GetKeys(kFakeAppId, |
+ base::Bind(&GCMKeyStoreTest::GotKeys, |
+ base::Unretained(this), &read_pair, |
+ &read_auth_secret)); |
+ |
+ base::RunLoop().RunUntilIdle(); |
+ |
+ ASSERT_FALSE(read_pair.IsInitialized()); |
+} |
+ |
TEST_F(GCMKeyStoreTest, GetKeysMultipleAppIds) { |
KeyPair pair; |
std::string auth_secret; |