| 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/user_list.h" | 5 #include "google_apis/gcm/engine/user_list.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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 static size_t GetListSize(const UserList* user_list); | 65 static size_t GetListSize(const UserList* user_list); |
| 66 void SetDelegateCallback(const std::string& username, | 66 void SetDelegateCallback(const std::string& username, |
| 67 int64 user_serial_number); | 67 int64 user_serial_number); |
| 68 | 68 |
| 69 scoped_ptr<UserList> BuildUserList(); | 69 scoped_ptr<UserList> BuildUserList(); |
| 70 | 70 |
| 71 void PumpLoop(); | 71 void PumpLoop(); |
| 72 | 72 |
| 73 void UpdateCallback(bool success); | 73 void UpdateCallback(bool success); |
| 74 | 74 |
| 75 void Initialize(UserList* user_list, const GCMStore::LoadResult& result); | 75 void Initialize(UserList* user_list, scoped_ptr<GCMStore::LoadResult> result); |
| 76 | 76 |
| 77 void ResetLoop(); | 77 void ResetLoop(); |
| 78 | 78 |
| 79 protected: | 79 protected: |
| 80 int64 last_assigned_serial_number_; | 80 int64 last_assigned_serial_number_; |
| 81 std::string last_assigned_username_; | 81 std::string last_assigned_username_; |
| 82 scoped_ptr<GCMStore> gcm_store_; | 82 scoped_ptr<GCMStore> gcm_store_; |
| 83 | 83 |
| 84 private: | 84 private: |
| 85 base::ScopedTempDir temp_directory_; | 85 base::ScopedTempDir temp_directory_; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 109 } | 109 } |
| 110 | 110 |
| 111 scoped_ptr<UserList> UserListTest::BuildUserList() { | 111 scoped_ptr<UserList> UserListTest::BuildUserList() { |
| 112 gcm_store_.reset(new GCMStoreImpl(true, | 112 gcm_store_.reset(new GCMStoreImpl(true, |
| 113 temp_directory_.path(), | 113 temp_directory_.path(), |
| 114 message_loop_.message_loop_proxy())); | 114 message_loop_.message_loop_proxy())); |
| 115 return scoped_ptr<UserList>(new UserList(gcm_store_.get())); | 115 return scoped_ptr<UserList>(new UserList(gcm_store_.get())); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void UserListTest::Initialize(UserList* user_list, | 118 void UserListTest::Initialize(UserList* user_list, |
| 119 const GCMStore::LoadResult& result) { | 119 scoped_ptr<GCMStore::LoadResult> result) { |
| 120 ASSERT_TRUE(result.success); | 120 ASSERT_TRUE(result->success); |
| 121 user_list->Initialize(result.serial_number_mappings); | 121 user_list->Initialize(result->serial_number_mappings); |
| 122 ResetLoop(); | 122 ResetLoop(); |
| 123 } | 123 } |
| 124 | 124 |
| 125 void UserListTest::ResetLoop() { | 125 void UserListTest::ResetLoop() { |
| 126 if (run_loop_ && run_loop_->running()) | 126 if (run_loop_ && run_loop_->running()) |
| 127 run_loop_->Quit(); | 127 run_loop_->Quit(); |
| 128 } | 128 } |
| 129 | 129 |
| 130 void UserListTest::PumpLoop() { | 130 void UserListTest::PumpLoop() { |
| 131 run_loop_.reset(new base::RunLoop); | 131 run_loop_.reset(new base::RunLoop); |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 // callbacks to be run. | 361 // callbacks to be run. |
| 362 PumpLoop(); | 362 PumpLoop(); |
| 363 PumpLoop(); | 363 PumpLoop(); |
| 364 | 364 |
| 365 EXPECT_EQ(last_assigned_serial_number_, | 365 EXPECT_EQ(last_assigned_serial_number_, |
| 366 user_list->GetSerialNumberForUsername(delegate->GetUsername())); | 366 user_list->GetSerialNumberForUsername(delegate->GetUsername())); |
| 367 EXPECT_EQ(delegate->GetUsername(), last_assigned_username_); | 367 EXPECT_EQ(delegate->GetUsername(), last_assigned_username_); |
| 368 } | 368 } |
| 369 | 369 |
| 370 } // namespace gcm | 370 } // namespace gcm |
| OLD | NEW |