| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 "app2", | 158 "app2", |
| 159 registration2, | 159 registration2, |
| 160 base::Bind(&GCMStoreImplTest::UpdateCallback, base::Unretained(this))); | 160 base::Bind(&GCMStoreImplTest::UpdateCallback, base::Unretained(this))); |
| 161 PumpLoop(); | 161 PumpLoop(); |
| 162 | 162 |
| 163 gcm_store = BuildGCMStore().Pass(); | 163 gcm_store = BuildGCMStore().Pass(); |
| 164 gcm_store->Load(base::Bind( | 164 gcm_store->Load(base::Bind( |
| 165 &GCMStoreImplTest::LoadCallback, base::Unretained(this), &load_result)); | 165 &GCMStoreImplTest::LoadCallback, base::Unretained(this), &load_result)); |
| 166 PumpLoop(); | 166 PumpLoop(); |
| 167 | 167 |
| 168 ASSERT_EQ(2, load_result->registrations.size()); | 168 ASSERT_EQ(2u, load_result->registrations.size()); |
| 169 ASSERT_TRUE(load_result->registrations.find("app1") != | 169 ASSERT_TRUE(load_result->registrations.find("app1") != |
| 170 load_result->registrations.end()); | 170 load_result->registrations.end()); |
| 171 EXPECT_EQ(registration1->registration_id, | 171 EXPECT_EQ(registration1->registration_id, |
| 172 load_result->registrations["app1"]->registration_id); | 172 load_result->registrations["app1"]->registration_id); |
| 173 ASSERT_EQ(1, load_result->registrations["app1"]->sender_ids.size()); | 173 ASSERT_EQ(1u, load_result->registrations["app1"]->sender_ids.size()); |
| 174 EXPECT_EQ(registration1->sender_ids[0], | 174 EXPECT_EQ(registration1->sender_ids[0], |
| 175 load_result->registrations["app1"]->sender_ids[0]); | 175 load_result->registrations["app1"]->sender_ids[0]); |
| 176 ASSERT_TRUE(load_result->registrations.find("app2") != | 176 ASSERT_TRUE(load_result->registrations.find("app2") != |
| 177 load_result->registrations.end()); | 177 load_result->registrations.end()); |
| 178 EXPECT_EQ(registration2->registration_id, | 178 EXPECT_EQ(registration2->registration_id, |
| 179 load_result->registrations["app2"]->registration_id); | 179 load_result->registrations["app2"]->registration_id); |
| 180 ASSERT_EQ(2, load_result->registrations["app2"]->sender_ids.size()); | 180 ASSERT_EQ(2u, load_result->registrations["app2"]->sender_ids.size()); |
| 181 EXPECT_EQ(registration2->sender_ids[0], | 181 EXPECT_EQ(registration2->sender_ids[0], |
| 182 load_result->registrations["app2"]->sender_ids[0]); | 182 load_result->registrations["app2"]->sender_ids[0]); |
| 183 EXPECT_EQ(registration2->sender_ids[1], | 183 EXPECT_EQ(registration2->sender_ids[1], |
| 184 load_result->registrations["app2"]->sender_ids[1]); | 184 load_result->registrations["app2"]->sender_ids[1]); |
| 185 } | 185 } |
| 186 | 186 |
| 187 // Verify saving some incoming messages, reopening the directory, and then | 187 // Verify saving some incoming messages, reopening the directory, and then |
| 188 // removing those incoming messages. | 188 // removing those incoming messages. |
| 189 TEST_F(GCMStoreImplTest, IncomingMessages) { | 189 TEST_F(GCMStoreImplTest, IncomingMessages) { |
| 190 scoped_ptr<GCMStore> gcm_store(BuildGCMStore()); | 190 scoped_ptr<GCMStore> gcm_store(BuildGCMStore()); |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 | 464 |
| 465 gcm_store->Load(base::Bind(&GCMStoreImplTest::LoadCallback, | 465 gcm_store->Load(base::Bind(&GCMStoreImplTest::LoadCallback, |
| 466 base::Unretained(this), | 466 base::Unretained(this), |
| 467 &load_result)); | 467 &load_result)); |
| 468 PumpLoop(); | 468 PumpLoop(); |
| 469 } | 469 } |
| 470 | 470 |
| 471 } // namespace | 471 } // namespace |
| 472 | 472 |
| 473 } // namespace gcm | 473 } // namespace gcm |
| OLD | NEW |