OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/gcm_driver/crypto/gcm_key_store.h" | 5 #include "components/gcm_driver/crypto/gcm_key_store.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 protected: | 61 protected: |
62 GCMKeyStore* gcm_key_store() { return gcm_key_store_.get(); } | 62 GCMKeyStore* gcm_key_store() { return gcm_key_store_.get(); } |
63 | 63 |
64 private: | 64 private: |
65 base::MessageLoop message_loop_; | 65 base::MessageLoop message_loop_; |
66 base::ScopedTempDir scoped_temp_dir_; | 66 base::ScopedTempDir scoped_temp_dir_; |
67 | 67 |
68 scoped_refptr<GCMKeyStore> gcm_key_store_; | 68 scoped_refptr<GCMKeyStore> gcm_key_store_; |
69 }; | 69 }; |
70 | 70 |
71 TEST_F(GCMKeyStoreTest, CreatedByDefault) { | 71 TEST_F(GCMKeyStoreTest, EmptyByDefault) { |
72 KeyPair pair; | 72 KeyPair pair; |
73 gcm_key_store()->GetKeys(kFakeAppId, | 73 gcm_key_store()->GetKeys(kFakeAppId, |
74 base::Bind(&GCMKeyStoreTest::GotKeys, | 74 base::Bind(&GCMKeyStoreTest::GotKeys, |
75 base::Unretained(this), &pair)); | 75 base::Unretained(this), &pair)); |
76 | 76 |
77 base::RunLoop().RunUntilIdle(); | 77 base::RunLoop().RunUntilIdle(); |
78 | 78 |
79 ASSERT_FALSE(pair.IsInitialized()); | 79 ASSERT_FALSE(pair.IsInitialized()); |
80 EXPECT_FALSE(pair.has_type()); | 80 EXPECT_FALSE(pair.has_type()); |
81 } | 81 } |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 // to the asynchronous nature of operations, however, we can't rely on the | 222 // to the asynchronous nature of operations, however, we can't rely on the |
223 // write to have finished before the read begins. | 223 // write to have finished before the read begins. |
224 base::RunLoop().RunUntilIdle(); | 224 base::RunLoop().RunUntilIdle(); |
225 | 225 |
226 EXPECT_TRUE(pair.IsInitialized()); | 226 EXPECT_TRUE(pair.IsInitialized()); |
227 } | 227 } |
228 | 228 |
229 } // namespace | 229 } // namespace |
230 | 230 |
231 } // namespace gcm | 231 } // namespace gcm |
OLD | NEW |