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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 EXPECT_EQ(test.same_site_instance, | 421 EXPECT_EQ(test.same_site_instance, |
422 start_rvh == contents->GetRenderViewHost()) | 422 start_rvh == contents->GetRenderViewHost()) |
423 << test.description; | 423 << test.description; |
424 EXPECT_EQ(test.same_site_instance, | 424 EXPECT_EQ(test.same_site_instance, |
425 start_rph == contents->GetRenderProcessHost()) | 425 start_rph == contents->GetRenderProcessHost()) |
426 << test.description; | 426 << test.description; |
427 } | 427 } |
428 } | 428 } |
429 | 429 |
430 const SearchTestCase kInstantNTPTestCases[] = { | 430 const SearchTestCase kInstantNTPTestCases[] = { |
431 {"https://foo.com/instant?strk", false, "Valid Instant URL"}, | 431 {"https://foo.com/instant?strk", true, "Valid Instant URL"}, |
432 {"https://foo.com/instant#strk", false, "Valid Instant URL"}, | 432 {"https://foo.com/instant#strk", true, "Valid Instant URL"}, |
433 {"https://foo.com/url?strk", false, "Valid search URL"}, | 433 {"https://foo.com/url?strk", true, "Valid search URL"}, |
434 {"https://foo.com/url#strk", false, "Valid search URL"}, | 434 {"https://foo.com/url#strk", true, "Valid search URL"}, |
435 {"https://foo.com/alt?strk", false, "Valid alternative URL"}, | 435 {"https://foo.com/alt?strk", true, "Valid alternative URL"}, |
436 {"https://foo.com/alt#strk", false, "Valid alternative URL"}, | 436 {"https://foo.com/alt#strk", true, "Valid alternative URL"}, |
437 {"https://foo.com/url?strk&bar=", false, "No query terms"}, | 437 {"https://foo.com/url?strk&bar=", true, "No query terms"}, |
438 {"https://foo.com/url?strk&q=abc", false, "No query terms key"}, | 438 {"https://foo.com/url?strk&q=abc", true, "No query terms key"}, |
439 {"https://foo.com/url?strk#bar=abc", false, "Query terms key in ref"}, | 439 {"https://foo.com/url?strk#bar=abc", true, "Query terms key in ref"}, |
440 {"https://foo.com/url?strk&bar=abc", false, "Has query terms"}, | 440 {"https://foo.com/url?strk&bar=abc", false, "Has query terms"}, |
441 {"http://foo.com/instant?strk=1", false, "Insecure URL"}, | 441 {"http://foo.com/instant?strk=1", false, "Insecure URL"}, |
442 {"https://foo.com/instant", false, "No search term replacement"}, | 442 {"https://foo.com/instant", false, "No search term replacement"}, |
443 {"chrome://blank/", false, "Chrome scheme"}, | 443 {"chrome://blank/", false, "Chrome scheme"}, |
444 {"chrome-search://foo", false, "Chrome-search scheme"}, | 444 {"chrome-search://foo", false, "Chrome-search scheme"}, |
| 445 {chrome::kChromeSearchLocalNtpUrl, true, "Local new tab page"}, |
445 {"https://bar.com/instant?strk=1", false, "Random non-search page"}, | 446 {"https://bar.com/instant?strk=1", false, "Random non-search page"}, |
446 {chrome::kChromeSearchLocalNtpUrl, true, "Local new tab page"}, | |
447 {"https://foo.com/newtab?strk", true, "New tab URL"}, | |
448 {"http://foo.com/newtab?strk", false, "Insecure New tab URL"}, | |
449 }; | 447 }; |
450 | 448 |
451 TEST_F(SearchTest, InstantNTPExtendedEnabled) { | 449 TEST_F(SearchTest, InstantNTPExtendedEnabled) { |
452 EnableQueryExtractionForTesting(); | 450 EnableQueryExtractionForTesting(); |
| 451 // TODO(samarth): update test cases to use cacheable NTP URLs and remove this. |
| 452 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 453 "InstantExtended", "Group1 use_cacheable_ntp:0")); |
453 AddTab(browser(), GURL("chrome://blank")); | 454 AddTab(browser(), GURL("chrome://blank")); |
454 for (size_t i = 0; i < arraysize(kInstantNTPTestCases); ++i) { | 455 for (size_t i = 0; i < arraysize(kInstantNTPTestCases); ++i) { |
455 const SearchTestCase& test = kInstantNTPTestCases[i]; | 456 const SearchTestCase& test = kInstantNTPTestCases[i]; |
456 NavigateAndCommitActiveTab(GURL(test.url)); | 457 NavigateAndCommitActiveTab(GURL(test.url)); |
457 const content::WebContents* contents = | 458 const content::WebContents* contents = |
458 browser()->tab_strip_model()->GetWebContentsAt(0); | 459 browser()->tab_strip_model()->GetWebContentsAt(0); |
459 EXPECT_EQ(test.expected_result, IsInstantNTP(contents)) | 460 EXPECT_EQ(test.expected_result, IsInstantNTP(contents)) |
460 << test.url << " " << test.comment; | 461 << test.url << " " << test.comment; |
461 } | 462 } |
462 } | 463 } |
463 | 464 |
464 TEST_F(SearchTest, InstantNTPCustomNavigationEntry) { | 465 TEST_F(SearchTest, InstantNTPCustomNavigationEntry) { |
465 EnableQueryExtractionForTesting(); | 466 EnableQueryExtractionForTesting(); |
| 467 // TODO(samarth): update test cases to use cacheable NTP URLs and remove this. |
| 468 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 469 "InstantExtended", "Group1 use_cacheable_ntp:0")); |
466 AddTab(browser(), GURL("chrome://blank")); | 470 AddTab(browser(), GURL("chrome://blank")); |
467 for (size_t i = 0; i < arraysize(kInstantNTPTestCases); ++i) { | 471 for (size_t i = 0; i < arraysize(kInstantNTPTestCases); ++i) { |
468 const SearchTestCase& test = kInstantNTPTestCases[i]; | 472 const SearchTestCase& test = kInstantNTPTestCases[i]; |
469 NavigateAndCommitActiveTab(GURL(test.url)); | 473 NavigateAndCommitActiveTab(GURL(test.url)); |
470 content::WebContents* contents = | 474 content::WebContents* contents = |
471 browser()->tab_strip_model()->GetWebContentsAt(0); | 475 browser()->tab_strip_model()->GetWebContentsAt(0); |
472 content::NavigationController& controller = contents->GetController(); | 476 content::NavigationController& controller = contents->GetController(); |
473 controller.SetTransientEntry( | 477 controller.SetTransientEntry( |
474 controller.CreateNavigationEntry(GURL("chrome://blank"), | 478 controller.CreateNavigationEntry(GURL("chrome://blank"), |
475 content::Referrer(), | 479 content::Referrer(), |
476 content::PAGE_TRANSITION_LINK, | 480 content::PAGE_TRANSITION_LINK, |
477 false, | 481 false, |
478 std::string(), | 482 std::string(), |
479 contents->GetBrowserContext())); | 483 contents->GetBrowserContext())); |
480 // The active entry is chrome://blank and not an NTP. | 484 // The active entry is chrome://blank and not an NTP. |
481 EXPECT_FALSE(IsInstantNTP(contents)); | 485 EXPECT_FALSE(IsInstantNTP(contents)); |
482 EXPECT_EQ(test.expected_result, | 486 EXPECT_EQ(test.expected_result, |
483 NavEntryIsInstantNTP(contents, | 487 NavEntryIsInstantNTP(contents, |
484 controller.GetLastCommittedEntry())) | 488 controller.GetLastCommittedEntry())) |
485 << test.url << " " << test.comment; | 489 << test.url << " " << test.comment; |
486 } | 490 } |
487 } | 491 } |
488 | 492 |
489 TEST_F(SearchTest, InstantCacheableNTPNavigationEntry) { | 493 TEST_F(SearchTest, InstantCacheableNTPNavigationEntry) { |
| 494 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 495 "EmbeddedSearch", "Group1 use_cacheable_ntp:1")); |
| 496 |
490 AddTab(browser(), GURL("chrome://blank")); | 497 AddTab(browser(), GURL("chrome://blank")); |
491 content::WebContents* contents = | 498 content::WebContents* contents = |
492 browser()->tab_strip_model()->GetWebContentsAt(0); | 499 browser()->tab_strip_model()->GetWebContentsAt(0); |
493 content::NavigationController& controller = contents->GetController(); | 500 content::NavigationController& controller = contents->GetController(); |
494 // Local NTP. | 501 // Local NTP. |
495 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); | 502 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); |
496 EXPECT_TRUE(NavEntryIsInstantNTP(contents, | 503 EXPECT_TRUE(NavEntryIsInstantNTP(contents, |
497 controller.GetLastCommittedEntry())); | 504 controller.GetLastCommittedEntry())); |
498 // Instant page is not cacheable NTP. | 505 // Instant page is not cacheable NTP. |
499 NavigateAndCommitActiveTab(GetInstantURL(profile(), kDisableStartMargin, | 506 NavigateAndCommitActiveTab(GetInstantURL(profile(), kDisableStartMargin, |
500 false)); | 507 false)); |
501 EXPECT_FALSE(NavEntryIsInstantNTP(contents, | 508 EXPECT_FALSE(NavEntryIsInstantNTP(contents, |
502 controller.GetLastCommittedEntry())); | 509 controller.GetLastCommittedEntry())); |
503 // Test Cacheable NTP | 510 // Test Cacheable NTP |
504 NavigateAndCommitActiveTab(chrome::GetNewTabPageURL(profile())); | 511 NavigateAndCommitActiveTab(chrome::GetNewTabPageURL(profile())); |
505 EXPECT_TRUE(NavEntryIsInstantNTP(contents, | 512 EXPECT_TRUE(NavEntryIsInstantNTP(contents, |
506 controller.GetLastCommittedEntry())); | 513 controller.GetLastCommittedEntry())); |
507 } | 514 } |
508 | 515 |
509 TEST_F(SearchTest, InstantCacheableNTPNavigationEntryNewProfile) { | 516 TEST_F(SearchTest, InstantCacheableNTPNavigationEntryNewProfile) { |
| 517 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 518 "EmbeddedSearch", "Group1 use_cacheable_ntp:1")); |
510 SetSearchProvider(false, false); | 519 SetSearchProvider(false, false); |
511 AddTab(browser(), GURL(chrome::kChromeUINewTabURL)); | 520 AddTab(browser(), GURL(chrome::kChromeUINewTabURL)); |
512 content::WebContents* contents = | 521 content::WebContents* contents = |
513 browser()->tab_strip_model()->GetWebContentsAt(0); | 522 browser()->tab_strip_model()->GetWebContentsAt(0); |
514 content::NavigationController& controller = contents->GetController(); | 523 content::NavigationController& controller = contents->GetController(); |
515 // Test virtual url chrome://newtab for first NTP of a new profile | 524 // Test virtual url chrome://newtab for first NTP of a new profile |
516 EXPECT_TRUE(NavEntryIsInstantNTP(contents, | 525 EXPECT_TRUE(NavEntryIsInstantNTP(contents, |
517 controller.GetLastCommittedEntry())); | 526 controller.GetLastCommittedEntry())); |
518 // The new_tab_url gets set after the first NTP is visible. | 527 // The new_tab_url gets set after the first NTP is visible. |
519 SetSearchProvider(true, false); | 528 SetSearchProvider(true, false); |
520 EXPECT_TRUE(NavEntryIsInstantNTP(contents, | 529 EXPECT_TRUE(NavEntryIsInstantNTP(contents, |
521 controller.GetLastCommittedEntry())); | 530 controller.GetLastCommittedEntry())); |
522 } | 531 } |
523 | 532 |
524 TEST_F(SearchTest, UseLocalNTPInIncognito) { | 533 TEST_F(SearchTest, UseLocalNTPInIncognito) { |
| 534 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 535 "EmbeddedSearch", "Group1 use_cacheable_ntp:1")); |
525 EXPECT_EQ(GURL(), chrome::GetNewTabPageURL( | 536 EXPECT_EQ(GURL(), chrome::GetNewTabPageURL( |
526 profile()->GetOffTheRecordProfile())); | 537 profile()->GetOffTheRecordProfile())); |
527 } | 538 } |
528 | 539 |
529 TEST_F(SearchTest, UseLocalNTPIfNTPURLIsInsecure) { | 540 TEST_F(SearchTest, UseLocalNTPIfNTPURLIsInsecure) { |
| 541 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 542 "EmbeddedSearch", "Group1 use_cacheable_ntp:1")); |
530 // Set an insecure new tab page URL and verify that it's ignored. | 543 // Set an insecure new tab page URL and verify that it's ignored. |
531 SetSearchProvider(true, true); | 544 SetSearchProvider(true, true); |
532 EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl), | 545 EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl), |
533 chrome::GetNewTabPageURL(profile())); | 546 chrome::GetNewTabPageURL(profile())); |
534 } | 547 } |
535 | 548 |
536 TEST_F(SearchTest, UseLocalNTPIfNTPURLIsNotSet) { | 549 TEST_F(SearchTest, UseLocalNTPIfNTPURLIsNotSet) { |
| 550 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 551 "EmbeddedSearch", "Group1 use_cacheable_ntp:1")); |
537 // Set an insecure new tab page URL and verify that it's ignored. | 552 // Set an insecure new tab page URL and verify that it's ignored. |
538 SetSearchProvider(false, true); | 553 SetSearchProvider(false, true); |
539 EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl), | 554 EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl), |
540 chrome::GetNewTabPageURL(profile())); | 555 chrome::GetNewTabPageURL(profile())); |
541 } | 556 } |
542 | 557 |
543 TEST_F(SearchTest, UseLocalNTPIfNTPURLIsBlockedForSupervisedUser) { | 558 TEST_F(SearchTest, UseLocalNTPIfNTPURLIsBlockedForSupervisedUser) { |
| 559 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 560 "EmbeddedSearch", "Group1 use_cacheable_ntp:1")); |
| 561 |
544 // Block access to foo.com in the URL filter. | 562 // Block access to foo.com in the URL filter. |
545 ManagedUserService* managed_user_service = | 563 ManagedUserService* managed_user_service = |
546 ManagedUserServiceFactory::GetForProfile(profile()); | 564 ManagedUserServiceFactory::GetForProfile(profile()); |
547 ManagedModeURLFilter* url_filter = | 565 ManagedModeURLFilter* url_filter = |
548 managed_user_service->GetURLFilterForUIThread(); | 566 managed_user_service->GetURLFilterForUIThread(); |
549 std::map<std::string, bool> hosts; | 567 std::map<std::string, bool> hosts; |
550 hosts["foo.com"] = false; | 568 hosts["foo.com"] = false; |
551 url_filter->SetManualHosts(&hosts); | 569 url_filter->SetManualHosts(&hosts); |
552 | 570 |
553 EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl), | 571 EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl), |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 | 658 |
641 // If we specify extra search query params, they should be inserted into the | 659 // If we specify extra search query params, they should be inserted into the |
642 // query portion of the instant URL. | 660 // query portion of the instant URL. |
643 CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 661 CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
644 switches::kExtraSearchQueryParams, "a=b"); | 662 switches::kExtraSearchQueryParams, "a=b"); |
645 instant_url = GetInstantURL(profile(), kDisableStartMargin, false); | 663 instant_url = GetInstantURL(profile(), kDisableStartMargin, false); |
646 ASSERT_TRUE(instant_url.is_valid()); | 664 ASSERT_TRUE(instant_url.is_valid()); |
647 EXPECT_EQ("http://www.bar.com/webhp?a=b&strk", instant_url.spec()); | 665 EXPECT_EQ("http://www.bar.com/webhp?a=b&strk", instant_url.spec()); |
648 } | 666 } |
649 | 667 |
| 668 TEST_F(SearchTest, ShouldShowInstantNTP_Default) { |
| 669 EXPECT_FALSE(ShouldShowInstantNTP()); |
| 670 } |
| 671 |
| 672 TEST_F(SearchTest, ShouldShowInstantNTP_DisabledViaFinch) { |
| 673 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 674 "EmbeddedSearch", "Group1 show_ntp:0")); |
| 675 EXPECT_FALSE(ShouldShowInstantNTP()); |
| 676 } |
| 677 |
| 678 TEST_F(SearchTest, ShouldShowInstantNTP_DisabledByUseCacheableNTPFinchFlag) { |
| 679 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 680 "EmbeddedSearch", "Group1 use_cacheable_ntp:1")); |
| 681 EXPECT_FALSE(ShouldShowInstantNTP()); |
| 682 } |
| 683 |
| 684 TEST_F(SearchTest, ShouldUseCacheableNTP_Default) { |
| 685 EXPECT_TRUE(ShouldUseCacheableNTP()); |
| 686 } |
| 687 |
| 688 TEST_F(SearchTest, ShouldUseCacheableNTP_EnabledViaFinch) { |
| 689 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 690 "EmbeddedSearch", "Group1 use_cacheable_ntp:1")); |
| 691 EXPECT_TRUE(ShouldUseCacheableNTP()); |
| 692 } |
| 693 |
| 694 TEST_F(SearchTest, ShouldPrefetchSearchResults_Default) { |
| 695 EXPECT_FALSE(ShouldPrefetchSearchResults()); |
| 696 } |
| 697 |
650 TEST_F(SearchTest, ShouldPrefetchSearchResults_InstantExtendedAPIEnabled) { | 698 TEST_F(SearchTest, ShouldPrefetchSearchResults_InstantExtendedAPIEnabled) { |
651 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | 699 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
652 "EmbeddedSearch", | 700 "EmbeddedSearch", |
653 "Group1 espv:2 prefetch_results:1")); | 701 "Group1 espv:2 use_cacheable_ntp:1 prefetch_results:1")); |
654 EXPECT_TRUE(ShouldPrefetchSearchResults()); | 702 EXPECT_TRUE(ShouldPrefetchSearchResults()); |
655 #if defined(OS_IOS) || defined(OS_ANDROID) | 703 #if defined(OS_IOS) || defined(OS_ANDROID) |
656 EXPECT_EQ(1ul, EmbeddedSearchPageVersion()); | 704 EXPECT_EQ(1ul, EmbeddedSearchPageVersion()); |
657 #else | 705 #else |
658 EXPECT_EQ(2ul, EmbeddedSearchPageVersion()); | 706 EXPECT_EQ(2ul, EmbeddedSearchPageVersion()); |
659 #endif | 707 #endif |
660 } | 708 } |
661 | 709 |
662 TEST_F(SearchTest, ShouldPrefetchSearchResults_DisabledViaFinch) { | 710 TEST_F(SearchTest, ShouldPrefetchSearchResults_DisabledViaFinch) { |
663 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | 711 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
664 "EmbeddedSearch", | 712 "EmbeddedSearch", |
665 "Group1 espv:89 prefetch_results:0")); | 713 "Group1 use_cacheable_ntp:1 espv:89 prefetch_results:0")); |
666 EXPECT_FALSE(ShouldPrefetchSearchResults()); | 714 EXPECT_FALSE(ShouldPrefetchSearchResults()); |
667 EXPECT_EQ(89ul, EmbeddedSearchPageVersion()); | 715 EXPECT_EQ(89ul, EmbeddedSearchPageVersion()); |
668 } | 716 } |
669 | 717 |
670 TEST_F(SearchTest, ShouldPrefetchSearchResults_EnabledViaFinch) { | 718 TEST_F(SearchTest, ShouldPrefetchSearchResults_EnabledViaFinch) { |
671 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | 719 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
672 "EmbeddedSearch", | 720 "EmbeddedSearch", |
673 "Group1 espv:80 prefetch_results:1")); | 721 "Group1 espv:80 use_cacheable_ntp:1 prefetch_results:1")); |
674 EXPECT_TRUE(ShouldPrefetchSearchResults()); | 722 EXPECT_TRUE(ShouldPrefetchSearchResults()); |
675 EXPECT_EQ(80ul, EmbeddedSearchPageVersion()); | 723 EXPECT_EQ(80ul, EmbeddedSearchPageVersion()); |
676 } | 724 } |
677 | 725 |
678 TEST_F(SearchTest, IsNTPURL) { | 726 TEST_F(SearchTest, IsNTPURL) { |
679 GURL invalid_url; | 727 GURL invalid_url; |
680 GURL ntp_url(chrome::kChromeUINewTabURL); | 728 GURL ntp_url(chrome::kChromeUINewTabURL); |
681 GURL local_ntp_url(GetLocalInstantURL(profile())); | 729 GURL local_ntp_url(GetLocalInstantURL(profile())); |
682 | 730 |
683 EXPECT_FALSE(chrome::IsNTPURL(invalid_url, profile())); | 731 EXPECT_FALSE(chrome::IsNTPURL(invalid_url, profile())); |
(...skipping 24 matching lines...) Expand all Loading... |
708 EXPECT_EQ("http://foo.com/url?bar=", search_urls[1].spec()); | 756 EXPECT_EQ("http://foo.com/url?bar=", search_urls[1].spec()); |
709 } | 757 } |
710 | 758 |
711 TEST_F(SearchTest, GetSearchResultPrefetchBaseURL) { | 759 TEST_F(SearchTest, GetSearchResultPrefetchBaseURL) { |
712 // "prefetch_results" flag is disabled. | 760 // "prefetch_results" flag is disabled. |
713 EXPECT_EQ(GURL(), GetSearchResultPrefetchBaseURL(profile())); | 761 EXPECT_EQ(GURL(), GetSearchResultPrefetchBaseURL(profile())); |
714 | 762 |
715 // "prefetch_results" flag is enabled via field trials. | 763 // "prefetch_results" flag is enabled via field trials. |
716 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | 764 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
717 "EmbeddedSearch", | 765 "EmbeddedSearch", |
718 "Group1 espv:80 prefetch_results:1")); | 766 "Group1 espv:80 use_cacheable_ntp:1 prefetch_results:1")); |
719 EXPECT_TRUE(ShouldPrefetchSearchResults()); | 767 EXPECT_TRUE(ShouldPrefetchSearchResults()); |
720 | 768 |
721 EXPECT_EQ(GURL("https://foo.com/instant?ion=1&foo=foo#foo=foo&strk"), | 769 EXPECT_EQ(GURL("https://foo.com/instant?ion=1&foo=foo#foo=foo&strk"), |
722 GetSearchResultPrefetchBaseURL(profile())); | 770 GetSearchResultPrefetchBaseURL(profile())); |
723 } | 771 } |
724 | 772 |
725 typedef SearchTest IsQueryExtractionEnabledTest; | 773 typedef SearchTest IsQueryExtractionEnabledTest; |
726 | 774 |
727 TEST_F(IsQueryExtractionEnabledTest, NotSet) { | 775 TEST_F(IsQueryExtractionEnabledTest, NotSet) { |
728 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | 776 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 } | 990 } |
943 | 991 |
944 TEST_F(OriginChipTest, CommandLineOriginChipLeadingMenuButton) { | 992 TEST_F(OriginChipTest, CommandLineOriginChipLeadingMenuButton) { |
945 CommandLine::ForCurrentProcess()->AppendSwitch( | 993 CommandLine::ForCurrentProcess()->AppendSwitch( |
946 switches::kEnableOriginChipLeadingMenuButton); | 994 switches::kEnableOriginChipLeadingMenuButton); |
947 EXPECT_TRUE(ShouldDisplayOriginChip()); | 995 EXPECT_TRUE(ShouldDisplayOriginChip()); |
948 EXPECT_EQ(ORIGIN_CHIP_LEADING_MENU_BUTTON, GetOriginChipPosition()); | 996 EXPECT_EQ(ORIGIN_CHIP_LEADING_MENU_BUTTON, GetOriginChipPosition()); |
949 } | 997 } |
950 | 998 |
951 } // namespace chrome | 999 } // namespace chrome |
OLD | NEW |