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

Side by Side Diff: chrome/browser/ui/toolbar/toolbar_model_unittest.cc

Issue 24153012: Fix cyclic dependency between ProfilePolicyConnector and PrefService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix/Extend NetworkConfigurationUpdater unit test. Created 7 years, 1 month 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/ui/toolbar/toolbar_model.h" 5 #include "chrome/browser/ui/toolbar/toolbar_model.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" 11 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
12 #include "chrome/browser/search/search.h" 12 #include "chrome/browser/search/search.h"
13 #include "chrome/browser/search_engines/search_terms_data.h" 13 #include "chrome/browser/search_engines/search_terms_data.h"
14 #include "chrome/browser/search_engines/template_url.h" 14 #include "chrome/browser/search_engines/template_url.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/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
18 #include "chrome/browser/ui/tabs/tab_strip_model.h" 18 #include "chrome/browser/ui/tabs/tab_strip_model.h"
19 #include "chrome/browser/ui/toolbar/toolbar_model.h" 19 #include "chrome/browser/ui/toolbar/toolbar_model.h"
20 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
21 #include "chrome/test/base/browser_with_test_window_test.h" 21 #include "chrome/test/base/browser_with_test_window_test.h"
22 #include "content/public/browser/navigation_entry.h" 22 #include "content/public/browser/navigation_entry.h"
23 #include "content/public/browser/render_process_host.h" 23 #include "content/public/browser/render_process_host.h"
24 #include "content/public/browser/web_contents.h" 24 #include "content/public/browser/web_contents.h"
25 #include "content/public/common/ssl_status.h" 25 #include "content/public/common/ssl_status.h"
26 #include "content/public/common/url_constants.h" 26 #include "content/public/common/url_constants.h"
27 #include "net/base/escape.h" 27 #include "net/base/escape.h"
28 28
29 #if defined(OS_CHROMEOS)
30 #include "chrome/browser/chromeos/policy/network_policy_service_factory.h"
31 #endif
29 32
30 // Test data ------------------------------------------------------------------ 33 // Test data ------------------------------------------------------------------
31 34
32 namespace { 35 namespace {
33 36
34 struct TestItem { 37 struct TestItem {
35 GURL url; 38 GURL url;
36 string16 expected_text; 39 string16 expected_text;
37 // The expected text to display when query extraction is inactive. 40 // The expected text to display when query extraction is inactive.
38 string16 expected_replace_text_inactive; 41 string16 expected_replace_text_inactive;
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 }; 175 };
173 176
174 ToolbarModelTest::ToolbarModelTest() { 177 ToolbarModelTest::ToolbarModelTest() {
175 } 178 }
176 179
177 ToolbarModelTest::~ToolbarModelTest() { 180 ToolbarModelTest::~ToolbarModelTest() {
178 } 181 }
179 182
180 void ToolbarModelTest::SetUp() { 183 void ToolbarModelTest::SetUp() {
181 BrowserWithTestWindowTest::SetUp(); 184 BrowserWithTestWindowTest::SetUp();
185
186 #if defined(OS_CHROMEOS)
187 policy::NetworkPolicyServiceFactory::GetInstance()->SetTestingFactory(
188 profile(), NULL);
189 #endif
Joao da Silva 2013/11/11 12:38:19 Isn't it cleaner to override ServiceIsNULLWhileTes
pneubeck (no reviews) 2013/11/12 10:07:53 Done.
190
182 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( 191 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse(
183 profile(), &TemplateURLServiceFactory::BuildInstanceFor); 192 profile(), &TemplateURLServiceFactory::BuildInstanceFor);
184 AutocompleteClassifierFactory::GetInstance()->SetTestingFactoryAndUse( 193 AutocompleteClassifierFactory::GetInstance()->SetTestingFactoryAndUse(
185 profile(), &AutocompleteClassifierFactory::BuildInstanceFor); 194 profile(), &AutocompleteClassifierFactory::BuildInstanceFor);
186 UIThreadSearchTermsData::SetGoogleBaseURL("http://google.com/"); 195 UIThreadSearchTermsData::SetGoogleBaseURL("http://google.com/");
187 } 196 }
188 197
189 void ToolbarModelTest::ResetDefaultTemplateURL() { 198 void ToolbarModelTest::ResetDefaultTemplateURL() {
190 ResetTemplateURLForInstant(GURL("http://does/not/exist")); 199 ResetTemplateURLForInstant(GURL("http://does/not/exist"));
191 } 200 }
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 // The same URL, when specified on the command line, should allow search term 359 // The same URL, when specified on the command line, should allow search term
351 // extraction. 360 // extraction.
352 UIThreadSearchTermsData::SetGoogleBaseURL(std::string()); 361 UIThreadSearchTermsData::SetGoogleBaseURL(std::string());
353 CommandLine::ForCurrentProcess()->AppendSwitchASCII(switches::kGoogleBaseURL, 362 CommandLine::ForCurrentProcess()->AppendSwitchASCII(switches::kGoogleBaseURL,
354 "http://www.foo.com/"); 363 "http://www.foo.com/");
355 NavigateAndCheckText( 364 NavigateAndCheckText(
356 GURL("http://www.foo.com/search?q=tractor+supply&espv=1"), 365 GURL("http://www.foo.com/search?q=tractor+supply&espv=1"),
357 ASCIIToUTF16("www.foo.com/search?q=tractor+supply&espv=1"), 366 ASCIIToUTF16("www.foo.com/search?q=tractor+supply&espv=1"),
358 ASCIIToUTF16("tractor supply"), true, true); 367 ASCIIToUTF16("tractor supply"), true, true);
359 } 368 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698