| 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 std::set<std::string> accounts; |
| 154 accounts.insert("test_user1@gmail.com"); |
| 155 accounts.insert("test_user2@gmail.com"); |
| 153 | 156 |
| 154 gcm_store->SetLastCheckinTime( | 157 gcm_store->SetLastCheckinInfo( |
| 155 last_checkin_time, | 158 last_checkin_time, |
| 159 accounts, |
| 156 base::Bind(&GCMStoreImplTest::UpdateCallback, base::Unretained(this))); | 160 base::Bind(&GCMStoreImplTest::UpdateCallback, base::Unretained(this))); |
| 157 PumpLoop(); | 161 PumpLoop(); |
| 158 | 162 |
| 159 gcm_store = BuildGCMStore().Pass(); | 163 gcm_store = BuildGCMStore().Pass(); |
| 160 gcm_store->Load(base::Bind( | 164 gcm_store->Load(base::Bind( |
| 161 &GCMStoreImplTest::LoadCallback, base::Unretained(this), &load_result)); | 165 &GCMStoreImplTest::LoadCallback, base::Unretained(this), &load_result)); |
| 162 PumpLoop(); | 166 PumpLoop(); |
| 163 ASSERT_EQ(last_checkin_time, load_result->last_checkin_time); | 167 ASSERT_EQ(last_checkin_time, load_result->last_checkin_time); |
| 168 ASSERT_EQ(accounts, load_result->last_checkin_accounts); |
| 164 } | 169 } |
| 165 | 170 |
| 166 TEST_F(GCMStoreImplTest, GServicesSettings_ProtocolV2) { | 171 TEST_F(GCMStoreImplTest, GServicesSettings_ProtocolV2) { |
| 167 scoped_ptr<GCMStore> gcm_store(BuildGCMStore()); | 172 scoped_ptr<GCMStore> gcm_store(BuildGCMStore()); |
| 168 scoped_ptr<GCMStore::LoadResult> load_result; | 173 scoped_ptr<GCMStore::LoadResult> load_result; |
| 169 gcm_store->Load(base::Bind( | 174 gcm_store->Load(base::Bind( |
| 170 &GCMStoreImplTest::LoadCallback, base::Unretained(this), &load_result)); | 175 &GCMStoreImplTest::LoadCallback, base::Unretained(this), &load_result)); |
| 171 PumpLoop(); | 176 PumpLoop(); |
| 172 | 177 |
| 173 std::map<std::string, std::string> settings; | 178 std::map<std::string, std::string> settings; |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 | 548 |
| 544 gcm_store->Load(base::Bind(&GCMStoreImplTest::LoadCallback, | 549 gcm_store->Load(base::Bind(&GCMStoreImplTest::LoadCallback, |
| 545 base::Unretained(this), | 550 base::Unretained(this), |
| 546 &load_result)); | 551 &load_result)); |
| 547 PumpLoop(); | 552 PumpLoop(); |
| 548 } | 553 } |
| 549 | 554 |
| 550 } // namespace | 555 } // namespace |
| 551 | 556 |
| 552 } // namespace gcm | 557 } // namespace gcm |
| OLD | NEW |