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

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

Issue 147193003: [GCM] Fix memory leaks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix windows Created 6 years, 11 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/mcs_client_unittest.cc ('k') | google_apis/gcm/gcm_client_impl.h » ('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/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
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
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
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
OLDNEW
« no previous file with comments | « google_apis/gcm/engine/mcs_client_unittest.cc ('k') | google_apis/gcm/gcm_client_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698