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/instance_id/instance_id_driver.h" | 5 #include "components/gcm_driver/instance_id/instance_id_driver.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 | 10 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 } | 113 } |
114 | 114 |
115 InstanceIDDriverTest::~InstanceIDDriverTest() { | 115 InstanceIDDriverTest::~InstanceIDDriverTest() { |
116 } | 116 } |
117 | 117 |
118 void InstanceIDDriverTest::SetUp() { | 118 void InstanceIDDriverTest::SetUp() { |
119 gcm_driver_.reset(new FakeGCMDriverForInstanceID); | 119 gcm_driver_.reset(new FakeGCMDriverForInstanceID); |
120 RecreateInstanceIDDriver(); | 120 RecreateInstanceIDDriver(); |
121 } | 121 } |
122 | 122 |
123 void InstanceIDDriverTest::TearDown() {} | 123 void InstanceIDDriverTest::TearDown() { |
| 124 driver_.reset(); |
| 125 gcm_driver_.reset(); |
| 126 // |gcm_driver_| owns a GCMKeyStore that owns a ProtoDatabaseImpl whose |
| 127 // destructor deletes the underlying LevelDB on the task runner. |
| 128 base::RunLoop().RunUntilIdle(); |
| 129 } |
124 | 130 |
125 void InstanceIDDriverTest::RecreateInstanceIDDriver() { | 131 void InstanceIDDriverTest::RecreateInstanceIDDriver() { |
126 driver_.reset(new InstanceIDDriver(gcm_driver_.get())); | 132 driver_.reset(new InstanceIDDriver(gcm_driver_.get())); |
127 } | 133 } |
128 | 134 |
129 void InstanceIDDriverTest::WaitForAsyncOperation() { | 135 void InstanceIDDriverTest::WaitForAsyncOperation() { |
130 // No need to wait if async operation is not needed. | 136 // No need to wait if async operation is not needed. |
131 if (async_operation_completed_) | 137 if (async_operation_completed_) |
132 return; | 138 return; |
133 base::RunLoop run_loop; | 139 base::RunLoop run_loop; |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 GetToken(instance_id, kAuthorizedEntity1, kScope2, options); | 370 GetToken(instance_id, kAuthorizedEntity1, kScope2, options); |
365 EXPECT_FALSE(new_token1.empty()); | 371 EXPECT_FALSE(new_token1.empty()); |
366 EXPECT_NE(token1, new_token1); | 372 EXPECT_NE(token1, new_token1); |
367 | 373 |
368 // The other token is not affected by the deletion. | 374 // The other token is not affected by the deletion. |
369 EXPECT_EQ(token2, | 375 EXPECT_EQ(token2, |
370 GetToken(instance_id, kAuthorizedEntity2, kScope1, options)); | 376 GetToken(instance_id, kAuthorizedEntity2, kScope1, options)); |
371 } | 377 } |
372 | 378 |
373 } // namespace instance_id | 379 } // namespace instance_id |
OLD | NEW |