OLD | NEW |
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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/search_engines/template_url.h" | 9 #include "chrome/browser/search_engines/template_url.h" |
10 #include "chrome/browser/search_engines/template_url_service.h" | 10 #include "chrome/browser/search_engines/template_url_service.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 }, | 76 }, |
77 { | 77 { |
78 GURL("http://searchurl/?q=tractor+supply"), | 78 GURL("http://searchurl/?q=tractor+supply"), |
79 ASCIIToUTF16("searchurl/?q=tractor+supply"), | 79 ASCIIToUTF16("searchurl/?q=tractor+supply"), |
80 ASCIIToUTF16("searchurl/?q=tractor+supply"), | 80 ASCIIToUTF16("searchurl/?q=tractor+supply"), |
81 ASCIIToUTF16("searchurl/?q=tractor+supply"), | 81 ASCIIToUTF16("searchurl/?q=tractor+supply"), |
82 false, | 82 false, |
83 true | 83 true |
84 }, | 84 }, |
85 { | 85 { |
| 86 GURL("http://google.ca/search?q=tractor+supply"), |
| 87 ASCIIToUTF16("google.ca/search?q=tractor+supply"), |
| 88 ASCIIToUTF16("google.ca/search?q=tractor+supply"), |
| 89 ASCIIToUTF16("google.ca/search?q=tractor+supply"), |
| 90 false, |
| 91 true |
| 92 }, |
| 93 { |
86 GURL("http://google.com/search?q=tractor+supply"), | 94 GURL("http://google.com/search?q=tractor+supply"), |
87 ASCIIToUTF16("google.com/search?q=tractor+supply"), | 95 ASCIIToUTF16("google.com/search?q=tractor+supply"), |
88 ASCIIToUTF16("google.com/search?q=tractor+supply"), | 96 ASCIIToUTF16("google.com/search?q=tractor+supply"), |
89 ASCIIToUTF16("google.com/search?q=tractor+supply"), | |
90 false, | |
91 true | |
92 }, | |
93 { | |
94 GURL("http://google.com/search?q=tractor+supply&espv=1"), | |
95 ASCIIToUTF16("google.com/search?q=tractor+supply&espv=1"), | |
96 ASCIIToUTF16("google.com/search?q=tractor+supply&espv=1"), | |
97 ASCIIToUTF16("tractor supply"), | 97 ASCIIToUTF16("tractor supply"), |
98 true, | 98 true, |
99 true | 99 true |
100 } | 100 } |
101 }; | 101 }; |
102 | 102 |
103 } // end namespace | 103 } // end namespace |
104 | 104 |
105 class ToolbarModelTest : public BrowserWithTestWindowTest { | 105 class ToolbarModelTest : public BrowserWithTestWindowTest { |
106 public: | 106 public: |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 for (size_t i = 0; i < arraysize(test_items); ++i) { | 177 for (size_t i = 0; i < arraysize(test_items); ++i) { |
178 const TestItem& test_item = test_items[i]; | 178 const TestItem& test_item = test_items[i]; |
179 NavigateAndCheckText(test_item.url, | 179 NavigateAndCheckText(test_item.url, |
180 test_item.expected_text, | 180 test_item.expected_text, |
181 test_item.expected_replace_text_inactive, | 181 test_item.expected_replace_text_inactive, |
182 false, | 182 false, |
183 test_item.should_display); | 183 test_item.should_display); |
184 } | 184 } |
185 } | 185 } |
186 | 186 |
187 // Test that we don't replace any URLs when the InstantExtended API is enabled. | 187 // Test that we replace URLs when the InstantExtended API is enabled. |
188 TEST_F(ToolbarModelTest, ShouldDisplayURLInstantExtendedAPIEnabled) { | 188 TEST_F(ToolbarModelTest, ShouldDisplayURLInstantExtendedAPIEnabled) { |
189 CommandLine::ForCurrentProcess()->AppendSwitch( | 189 CommandLine::ForCurrentProcess()->AppendSwitch( |
190 switches::kEnableInstantExtendedAPI); | 190 switches::kEnableInstantExtendedAPI); |
191 | 191 |
192 // Avoid tests on branded Chrome where channel is set to CHANNEL_STABLE. | 192 // Avoid tests on branded Chrome where channel is set to CHANNEL_STABLE. |
193 if (!chrome::search::IsInstantExtendedAPIEnabled(profile())) | 193 if (!chrome::search::IsInstantExtendedAPIEnabled(profile())) |
194 return; | 194 return; |
195 | 195 |
196 ResetDefaultTemplateURL(); | 196 ResetDefaultTemplateURL(); |
197 AddTab(browser(), GURL(chrome::kAboutBlankURL)); | 197 AddTab(browser(), GURL(chrome::kAboutBlankURL)); |
198 for (size_t i = 0; i < arraysize(test_items); ++i) { | 198 for (size_t i = 0; i < arraysize(test_items); ++i) { |
199 const TestItem& test_item = test_items[i]; | 199 const TestItem& test_item = test_items[i]; |
200 NavigateAndCheckText(test_item.url, | 200 NavigateAndCheckText(test_item.url, |
201 test_item.expected_text, | 201 test_item.expected_text, |
202 test_item.expected_replace_text_active, | 202 test_item.expected_replace_text_active, |
203 test_item.would_replace, | 203 test_item.would_replace, |
204 test_item.should_display); | 204 test_item.should_display); |
205 } | 205 } |
206 } | 206 } |
OLD | NEW |