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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 gcm_key_store_.reset(); | 41 gcm_key_store_.reset(); |
42 | 42 |
43 // |gcm_key_store_| owns a ProtoDatabaseImpl whose destructor deletes the | 43 // |gcm_key_store_| owns a ProtoDatabaseImpl whose destructor deletes the |
44 // underlying LevelDB database on the task runner. | 44 // underlying LevelDB database on the task runner. |
45 base::RunLoop().RunUntilIdle(); | 45 base::RunLoop().RunUntilIdle(); |
46 } | 46 } |
47 | 47 |
48 // Creates the GCM Key Store instance. May be called from within a test's body | 48 // Creates the GCM Key Store instance. May be called from within a test's body |
49 // to re-create the key store, causing the database to re-open. | 49 // to re-create the key store, causing the database to re-open. |
50 void CreateKeyStore() { | 50 void CreateKeyStore() { |
51 gcm_key_store_.reset( | 51 gcm_key_store_.reset(new GCMKeyStore(scoped_temp_dir_.GetPath(), |
52 new GCMKeyStore(scoped_temp_dir_.path(), message_loop_.task_runner())); | 52 message_loop_.task_runner())); |
53 } | 53 } |
54 | 54 |
55 // Callback to use with GCMKeyStore::{GetKeys, CreateKeys} calls. | 55 // Callback to use with GCMKeyStore::{GetKeys, CreateKeys} calls. |
56 void GotKeys(KeyPair* pair_out, std::string* auth_secret_out, | 56 void GotKeys(KeyPair* pair_out, std::string* auth_secret_out, |
57 const KeyPair& pair, const std::string& auth_secret) { | 57 const KeyPair& pair, const std::string& auth_secret) { |
58 *pair_out = pair; | 58 *pair_out = pair; |
59 *auth_secret_out = auth_secret; | 59 *auth_secret_out = auth_secret; |
60 } | 60 } |
61 | 61 |
62 protected: | 62 protected: |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 }, | 571 }, |
572 "Instance ID tokens cannot share an app_id with a non-InstanceID GCM " | 572 "Instance ID tokens cannot share an app_id with a non-InstanceID GCM " |
573 "registration"); | 573 "registration"); |
574 } | 574 } |
575 | 575 |
576 #endif // !defined(NDEBUG) && DCHECK_IS_ON() | 576 #endif // !defined(NDEBUG) && DCHECK_IS_ON() |
577 | 577 |
578 } // namespace | 578 } // namespace |
579 | 579 |
580 } // namespace gcm | 580 } // namespace gcm |
OLD | NEW |