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

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

Issue 11506006: [cros] RLZ tracking can be turned off via a flag file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Re-apply ps#16, it got lost Created 8 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_service_test_util.h" 5 #include "chrome/browser/search_engines/template_url_service_test_util.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/synchronization/waitable_event.h" 11 #include "base/synchronization/waitable_event.h"
12 #include "base/threading/thread.h" 12 #include "base/threading/thread.h"
13 #include "chrome/browser/google/google_url_tracker.h" 13 #include "chrome/browser/google/google_url_tracker.h"
14 #include "chrome/browser/search_engines/search_terms_data.h" 14 #include "chrome/browser/search_engines/search_terms_data.h"
15 #include "chrome/browser/search_engines/template_url_service.h" 15 #include "chrome/browser/search_engines/template_url_service.h"
16 #include "chrome/browser/search_engines/template_url_service_factory.h" 16 #include "chrome/browser/search_engines/template_url_service_factory.h"
17 #include "chrome/browser/webdata/web_data_service_factory.h" 17 #include "chrome/browser/webdata/web_data_service_factory.h"
18 #include "chrome/common/chrome_notification_types.h" 18 #include "chrome/common/chrome_notification_types.h"
19 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
20 #include "chrome/test/base/testing_pref_service.h" 20 #include "chrome/test/base/testing_pref_service.h"
21 #include "chrome/test/base/testing_profile.h" 21 #include "chrome/test/base/testing_profile.h"
22 #include "content/public/browser/notification_service.h" 22 #include "content/public/browser/notification_service.h"
23 #include "content/public/test/test_browser_thread.h" 23 #include "content/public/test/test_browser_thread.h"
24 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
25 25
26 #if defined(OS_CHROMEOS)
27 #include "chrome/browser/google/google_util_chromeos.h"
28 #endif
29
26 using content::BrowserThread; 30 using content::BrowserThread;
27 31
28 namespace { 32 namespace {
29 33
30 // A callback used to coordinate when the database has finished processing 34 // A callback used to coordinate when the database has finished processing
31 // requests. See note in BlockTillServiceProcessesRequests for details. 35 // requests. See note in BlockTillServiceProcessesRequests for details.
32 // 36 //
33 // Schedules a QuitClosure on the message loop it was created with. 37 // Schedules a QuitClosure on the message loop it was created with.
34 void QuitCallback(MessageLoop* message_loop) { 38 void QuitCallback(MessageLoop* message_loop) {
35 message_loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); 39 message_loop->PostTask(FROM_HERE, MessageLoop::QuitClosure());
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 profile_.reset(new TemplateURLServiceTestingProfile()); 172 profile_.reset(new TemplateURLServiceTestingProfile());
169 WebDataServiceFactory::GetInstance()->SetTestingFactory( 173 WebDataServiceFactory::GetInstance()->SetTestingFactory(
170 profile_.get(), TemplateURLServiceTestingProfile:: 174 profile_.get(), TemplateURLServiceTestingProfile::
171 GetWebDataServiceForTemplateURLServiceTestingProfile); 175 GetWebDataServiceForTemplateURLServiceTestingProfile);
172 176
173 profile_->SetUp(); 177 profile_->SetUp();
174 TemplateURLService* service = static_cast<TemplateURLService*>( 178 TemplateURLService* service = static_cast<TemplateURLService*>(
175 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( 179 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse(
176 profile_.get(), TestingTemplateURLService::Build)); 180 profile_.get(), TestingTemplateURLService::Build));
177 service->AddObserver(this); 181 service->AddObserver(this);
182
183 #if defined(OS_CHROMEOS)
184 google_util::chromeos::ClearBrandForCurrentSession();
185 #endif
178 } 186 }
179 187
180 void TemplateURLServiceTestUtil::TearDown() { 188 void TemplateURLServiceTestUtil::TearDown() {
181 if (profile_.get()) { 189 if (profile_.get()) {
182 profile_->TearDown(); 190 profile_->TearDown();
183 profile_.reset(); 191 profile_.reset();
184 } 192 }
185 UIThreadSearchTermsData::SetGoogleBaseURL(std::string()); 193 UIThreadSearchTermsData::SetGoogleBaseURL(std::string());
186 194
187 // Flush the message loop to make application verifiers happy. 195 // Flush the message loop to make application verifiers happy.
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 return profile_.get(); 315 return profile_.get();
308 } 316 }
309 317
310 void TemplateURLServiceTestUtil::StartIOThread() { 318 void TemplateURLServiceTestUtil::StartIOThread() {
311 profile_->StartIOThread(); 319 profile_->StartIOThread();
312 } 320 }
313 321
314 void TemplateURLServiceTestUtil::PumpLoop() { 322 void TemplateURLServiceTestUtil::PumpLoop() {
315 message_loop_.RunUntilIdle(); 323 message_loop_.RunUntilIdle();
316 } 324 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698