Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: google_apis/gcm/engine/gcm_store_impl_unittest.cc

Issue 378643002: [GCM] Check-in with signed in accounts associates device to user (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update to the code to prevent test crashes. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « google_apis/gcm/engine/gcm_store_impl.cc ('k') | google_apis/gcm/tools/mcs_probe.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « google_apis/gcm/engine/gcm_store_impl.cc ('k') | google_apis/gcm/tools/mcs_probe.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698