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

Side by Side Diff: chrome/browser/search_engines/template_url_model_test_util.cc

Issue 5646003: Sanitize PrefStore interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix PrefService mock construction in PrefServiceTest to include command line store. Created 10 years 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/search_engines/template_url_model_test_util.h" 5 #include "chrome/browser/search_engines/template_url_model_test_util.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/scoped_temp_dir.h" 9 #include "base/scoped_temp_dir.h"
10 #include "base/thread.h" 10 #include "base/thread.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 TemplateURLRef::SetGoogleBaseURL(NULL); 160 TemplateURLRef::SetGoogleBaseURL(NULL);
161 161
162 // Flush the message loop to make Purify happy. 162 // Flush the message loop to make Purify happy.
163 message_loop_.RunAllPending(); 163 message_loop_.RunAllPending();
164 } 164 }
165 165
166 void TemplateURLModelTestUtil::OnTemplateURLModelChanged() { 166 void TemplateURLModelTestUtil::OnTemplateURLModelChanged() {
167 changed_count_++; 167 changed_count_++;
168 } 168 }
169 169
170 void TemplateURLModelTestUtil::VerifyObserverCount(int expected_changed_count) { 170 int TemplateURLModelTestUtil::GetObserverCount() {
171 ASSERT_EQ(expected_changed_count, changed_count_); 171 return changed_count_;
172 changed_count_ = 0;
173 } 172 }
174 173
175 void TemplateURLModelTestUtil::ResetObserverCount() { 174 void TemplateURLModelTestUtil::ResetObserverCount() {
176 changed_count_ = 0; 175 changed_count_ = 0;
177 } 176 }
178 177
179 void TemplateURLModelTestUtil::BlockTillServiceProcessesRequests() { 178 void TemplateURLModelTestUtil::BlockTillServiceProcessesRequests() {
180 WaitForThreadToProcessRequests(BrowserThread::DB); 179 WaitForThreadToProcessRequests(BrowserThread::DB);
181 } 180 }
182 181
183 void TemplateURLModelTestUtil::BlockTillIOThreadProcessesRequests() { 182 void TemplateURLModelTestUtil::BlockTillIOThreadProcessesRequests() {
184 WaitForThreadToProcessRequests(BrowserThread::IO); 183 WaitForThreadToProcessRequests(BrowserThread::IO);
185 } 184 }
186 185
187 void TemplateURLModelTestUtil::VerifyLoad() { 186 void TemplateURLModelTestUtil::VerifyLoad() {
188 ASSERT_FALSE(model()->loaded()); 187 ASSERT_FALSE(model()->loaded());
189 model()->Load(); 188 model()->Load();
190 BlockTillServiceProcessesRequests(); 189 BlockTillServiceProcessesRequests();
191 VerifyObserverCount(1); 190 EXPECT_EQ(1, GetObserverCount());
191 ResetObserverCount();
192 } 192 }
193 193
194 void TemplateURLModelTestUtil::ChangeModelToLoadState() { 194 void TemplateURLModelTestUtil::ChangeModelToLoadState() {
195 model()->ChangeToLoadedState(); 195 model()->ChangeToLoadedState();
196 // Initialize the web data service so that the database gets updated with 196 // Initialize the web data service so that the database gets updated with
197 // any changes made. 197 // any changes made.
198 model()->service_ = profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); 198 model()->service_ = profile_->GetWebDataService(Profile::EXPLICIT_ACCESS);
199 } 199 }
200 200
201 void TemplateURLModelTestUtil::ClearModel() { 201 void TemplateURLModelTestUtil::ClearModel() {
(...skipping 29 matching lines...) Expand all
231 return profile_->GetTemplateURLModel(); 231 return profile_->GetTemplateURLModel();
232 } 232 }
233 233
234 TestingProfile* TemplateURLModelTestUtil::profile() const { 234 TestingProfile* TemplateURLModelTestUtil::profile() const {
235 return profile_.get(); 235 return profile_.get();
236 } 236 }
237 237
238 void TemplateURLModelTestUtil::StartIOThread() { 238 void TemplateURLModelTestUtil::StartIOThread() {
239 profile_->StartIOThread(); 239 profile_->StartIOThread();
240 } 240 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698