OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "google_apis/gcm/engine/gcm_store_impl.h" | 5 #include "google_apis/gcm/engine/gcm_store_impl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 135 |
136 gcm_store = BuildGCMStore().Pass(); | 136 gcm_store = BuildGCMStore().Pass(); |
137 gcm_store->Load(base::Bind( | 137 gcm_store->Load(base::Bind( |
138 &GCMStoreImplTest::LoadCallback, base::Unretained(this), &load_result)); | 138 &GCMStoreImplTest::LoadCallback, base::Unretained(this), &load_result)); |
139 PumpLoop(); | 139 PumpLoop(); |
140 | 140 |
141 ASSERT_EQ(kDeviceId, load_result->device_android_id); | 141 ASSERT_EQ(kDeviceId, load_result->device_android_id); |
142 ASSERT_EQ(kDeviceToken, load_result->device_security_token); | 142 ASSERT_EQ(kDeviceToken, load_result->device_security_token); |
143 } | 143 } |
144 | 144 |
145 TEST_F(GCMStoreImplTest, LastCheckinTime) { | 145 TEST_F(GCMStoreImplTest, LastCheckinInfo) { |
146 scoped_ptr<GCMStore> gcm_store(BuildGCMStore()); | 146 scoped_ptr<GCMStore> gcm_store(BuildGCMStore()); |
147 scoped_ptr<GCMStore::LoadResult> load_result; | 147 scoped_ptr<GCMStore::LoadResult> load_result; |
148 gcm_store->Load(base::Bind( | 148 gcm_store->Load(base::Bind( |
149 &GCMStoreImplTest::LoadCallback, base::Unretained(this), &load_result)); | 149 &GCMStoreImplTest::LoadCallback, base::Unretained(this), &load_result)); |
150 PumpLoop(); | 150 PumpLoop(); |
151 | 151 |
152 base::Time last_checkin_time = base::Time::Now(); | 152 base::Time last_checkin_time = base::Time::Now(); |
| 153 uint64 accounts_count = 2; // Anything above 0 does the job. |
153 | 154 |
154 gcm_store->SetLastCheckinTime( | 155 gcm_store->SetLastCheckinInfo( |
155 last_checkin_time, | 156 last_checkin_time, |
| 157 accounts_count, |
156 base::Bind(&GCMStoreImplTest::UpdateCallback, base::Unretained(this))); | 158 base::Bind(&GCMStoreImplTest::UpdateCallback, base::Unretained(this))); |
157 PumpLoop(); | 159 PumpLoop(); |
158 | 160 |
159 gcm_store = BuildGCMStore().Pass(); | 161 gcm_store = BuildGCMStore().Pass(); |
160 gcm_store->Load(base::Bind( | 162 gcm_store->Load(base::Bind( |
161 &GCMStoreImplTest::LoadCallback, base::Unretained(this), &load_result)); | 163 &GCMStoreImplTest::LoadCallback, base::Unretained(this), &load_result)); |
162 PumpLoop(); | 164 PumpLoop(); |
163 ASSERT_EQ(last_checkin_time, load_result->last_checkin_time); | 165 ASSERT_EQ(last_checkin_time, load_result->last_checkin_time); |
| 166 ASSERT_EQ(accounts_count, load_result->accounts_count); |
164 } | 167 } |
165 | 168 |
166 TEST_F(GCMStoreImplTest, GServicesSettings_ProtocolV2) { | 169 TEST_F(GCMStoreImplTest, GServicesSettings_ProtocolV2) { |
167 scoped_ptr<GCMStore> gcm_store(BuildGCMStore()); | 170 scoped_ptr<GCMStore> gcm_store(BuildGCMStore()); |
168 scoped_ptr<GCMStore::LoadResult> load_result; | 171 scoped_ptr<GCMStore::LoadResult> load_result; |
169 gcm_store->Load(base::Bind( | 172 gcm_store->Load(base::Bind( |
170 &GCMStoreImplTest::LoadCallback, base::Unretained(this), &load_result)); | 173 &GCMStoreImplTest::LoadCallback, base::Unretained(this), &load_result)); |
171 PumpLoop(); | 174 PumpLoop(); |
172 | 175 |
173 std::map<std::string, std::string> settings; | 176 std::map<std::string, std::string> settings; |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 | 546 |
544 gcm_store->Load(base::Bind(&GCMStoreImplTest::LoadCallback, | 547 gcm_store->Load(base::Bind(&GCMStoreImplTest::LoadCallback, |
545 base::Unretained(this), | 548 base::Unretained(this), |
546 &load_result)); | 549 &load_result)); |
547 PumpLoop(); | 550 PumpLoop(); |
548 } | 551 } |
549 | 552 |
550 } // namespace | 553 } // namespace |
551 | 554 |
552 } // namespace gcm | 555 } // namespace gcm |
OLD | NEW |