OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/metrics/field_trial.h" | 6 #include "base/metrics/field_trial.h" |
7 #include "base/metrics/histogram_base.h" | 7 #include "base/metrics/histogram_base.h" |
8 #include "base/metrics/histogram_samples.h" | 8 #include "base/metrics/histogram_samples.h" |
9 #include "base/metrics/statistics_recorder.h" | 9 #include "base/metrics/statistics_recorder.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 ShouldAssignURLToInstantRenderer(GURL(test.url), profile())) | 277 ShouldAssignURLToInstantRenderer(GURL(test.url), profile())) |
278 << test.url << " " << test.comment; | 278 << test.url << " " << test.comment; |
279 } | 279 } |
280 } | 280 } |
281 | 281 |
282 TEST_F(SearchTest, ShouldUseProcessPerSiteForInstantURL) { | 282 TEST_F(SearchTest, ShouldUseProcessPerSiteForInstantURL) { |
283 EnableQueryExtractionForTesting(); | 283 EnableQueryExtractionForTesting(); |
284 | 284 |
285 const SearchTestCase kTestCases[] = { | 285 const SearchTestCase kTestCases[] = { |
286 {"chrome-search://local-ntp", true, "Local NTP"}, | 286 {"chrome-search://local-ntp", true, "Local NTP"}, |
287 {"chrome-search://online-ntp", true, "Online NTP"}, | 287 {"chrome-search://remote-ntp", true, "Remote NTP"}, |
288 {"invalid-scheme://local-ntp", false, "Invalid Local NTP URL"}, | 288 {"invalid-scheme://local-ntp", false, "Invalid Local NTP URL"}, |
289 {"invalid-scheme://online-ntp", false, "Invalid Online NTP URL"}, | 289 {"invalid-scheme://online-ntp", false, "Invalid Online NTP URL"}, |
290 {"chrome-search://foo.com", false, "Search result page"}, | 290 {"chrome-search://foo.com", false, "Search result page"}, |
291 {"https://foo.com/instant?strk", false, ""}, | 291 {"https://foo.com/instant?strk", false, ""}, |
292 {"https://foo.com/instant#strk", false, ""}, | 292 {"https://foo.com/instant#strk", false, ""}, |
293 {"https://foo.com/instant?strk=0", false, ""}, | 293 {"https://foo.com/instant?strk=0", false, ""}, |
294 {"https://foo.com/url?strk", false, ""}, | 294 {"https://foo.com/url?strk", false, ""}, |
295 {"https://foo.com/alt?strk", false, ""}, | 295 {"https://foo.com/alt?strk", false, ""}, |
296 {"http://foo.com/instant", false, "Non-HTTPS"}, | 296 {"http://foo.com/instant", false, "Non-HTTPS"}, |
297 {"http://foo.com/instant?strk", false, "Non-HTTPS"}, | 297 {"http://foo.com/instant?strk", false, "Non-HTTPS"}, |
(...skipping 22 matching lines...) Expand all Loading... |
320 bool end_in_instant_process; | 320 bool end_in_instant_process; |
321 bool same_site_instance; | 321 bool same_site_instance; |
322 } kProcessIsolationTestCases[] = { | 322 } kProcessIsolationTestCases[] = { |
323 {"Local NTP -> SRP", | 323 {"Local NTP -> SRP", |
324 "chrome-search://local-ntp", true, | 324 "chrome-search://local-ntp", true, |
325 "https://foo.com/url?strk", true, false }, | 325 "https://foo.com/url?strk", true, false }, |
326 {"Local NTP -> Regular", | 326 {"Local NTP -> Regular", |
327 "chrome-search://local-ntp", true, | 327 "chrome-search://local-ntp", true, |
328 "https://foo.com/other", false, false }, | 328 "https://foo.com/other", false, false }, |
329 {"Remote NTP -> SRP", | 329 {"Remote NTP -> SRP", |
330 "https://foo.com/instant?strk", true, | 330 "https://foo.com/newtab?strk", true, |
331 "https://foo.com/url?strk", true, false }, | 331 "https://foo.com/url?strk", true, false }, |
332 {"Remote NTP -> Regular", | 332 {"Remote NTP -> Regular", |
333 "https://foo.com/instant?strk", true, | 333 "https://foo.com/newtab?strk", true, |
334 "https://foo.com/other", false, false }, | 334 "https://foo.com/other", false, false }, |
335 {"SRP -> SRP", | 335 {"SRP -> SRP", |
336 "https://foo.com/url?strk", true, | 336 "https://foo.com/url?strk", true, |
337 "https://foo.com/url?strk", true, true }, | 337 "https://foo.com/url?strk", true, true }, |
338 {"SRP -> Regular", | 338 {"SRP -> Regular", |
339 "https://foo.com/url?strk", true, | 339 "https://foo.com/url?strk", true, |
340 "https://foo.com/other", false, false }, | 340 "https://foo.com/other", false, false }, |
341 {"Regular -> SRP", | 341 {"Regular -> SRP", |
342 "https://foo.com/other", false, | 342 "https://foo.com/other", false, |
343 "https://foo.com/url?strk", true, false }, | 343 "https://foo.com/url?strk", true, false }, |
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1226 } | 1226 } |
1227 | 1227 |
1228 TEST_F(OriginChipV2Test, CommandLineHideOnUserInput) { | 1228 TEST_F(OriginChipV2Test, CommandLineHideOnUserInput) { |
1229 CommandLine::ForCurrentProcess()->AppendSwitch( | 1229 CommandLine::ForCurrentProcess()->AppendSwitch( |
1230 switches::kEnableOriginChipV2HideOnUserInput); | 1230 switches::kEnableOriginChipV2HideOnUserInput); |
1231 EXPECT_TRUE(ShouldDisplayOriginChipV2()); | 1231 EXPECT_TRUE(ShouldDisplayOriginChipV2()); |
1232 EXPECT_EQ(ORIGIN_CHIP_V2_HIDE_ON_USER_INPUT, GetOriginChipV2HideTrigger()); | 1232 EXPECT_EQ(ORIGIN_CHIP_V2_HIDE_ON_USER_INPUT, GetOriginChipV2HideTrigger()); |
1233 } | 1233 } |
1234 | 1234 |
1235 } // namespace chrome | 1235 } // namespace chrome |
OLD | NEW |