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

Side by Side Diff: chrome/browser/ui/search/search_ipc_router_unittest.cc

Issue 2143953002: Remove search::ShouldPrefetchSearchResultsOnSRP (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "chrome/browser/ui/search/search_ipc_router.h" 5 #include "chrome/browser/ui/search/search_ipc_router.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <tuple> 10 #include <tuple>
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 SetupMockDelegateAndPolicy(); 570 SetupMockDelegateAndPolicy();
571 MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy(); 571 MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy();
572 EXPECT_CALL(*policy, ShouldSendSetPromoInformation()).Times(1) 572 EXPECT_CALL(*policy, ShouldSendSetPromoInformation()).Times(1)
573 .WillOnce(testing::Return(false)); 573 .WillOnce(testing::Return(false));
574 574
575 GetSearchIPCRouter().SetPromoInformation(false); 575 GetSearchIPCRouter().SetPromoInformation(false);
576 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxPromoInformation::ID)); 576 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxPromoInformation::ID));
577 } 577 }
578 578
579 TEST_F(SearchIPCRouterTest, 579 TEST_F(SearchIPCRouterTest,
580 SendSetDisplayInstantResultsMsg_EnableInstantOnResultsPage) {
581 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial(
582 "EmbeddedSearch",
583 "Group1 espv:42 query_extraction:1 prefetch_results_srp:1"));
584 NavigateAndCommitActiveTab(GURL("https://foo.com/url?espv&bar=abc"));
585
586 // Make sure ChromeViewMsg_SearchBoxSetDisplayInstantResults message param is
587 // set to true if the underlying page is a results page and
588 // "prefetch_results_srp" flag is enabled via field trials.
589 VerifyDisplayInstantResultsMsg(true);
590 }
591
592 TEST_F(SearchIPCRouterTest,
593 SendSetDisplayInstantResultsMsg_DisableInstantOnResultsPage) { 580 SendSetDisplayInstantResultsMsg_DisableInstantOnResultsPage) {
594 // |prefetch_results_srp" flag is disabled via field trials.
595 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( 581 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial(
596 "EmbeddedSearch", 582 "EmbeddedSearch",
597 "Group1 espv:42 query_extraction:1 prefetch_results_srp:0")); 583 "Group1 espv:42 query_extraction:1"));
598 NavigateAndCommitActiveTab(GURL("https://foo.com/url?espv&bar=abc")); 584 NavigateAndCommitActiveTab(GURL("https://foo.com/url?espv&bar=abc"));
599 585
600 // Make sure ChromeViewMsg_SearchBoxSetDisplayInstantResults message param is 586 // Make sure ChromeViewMsg_SearchBoxSetDisplayInstantResults message param is
601 // set to false. 587 // set to false.
602 VerifyDisplayInstantResultsMsg(false); 588 VerifyDisplayInstantResultsMsg(false);
603 } 589 }
604 590
605 TEST_F(SearchIPCRouterTest, 591 TEST_F(SearchIPCRouterTest,
606 SendSetDisplayInstantResultsMsg_EnableInstantOutsideSearchResultsPage) { 592 SendSetDisplayInstantResultsMsg_EnableInstantOutsideSearchResultsPage) {
607 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl)); 593 NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl));
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 770
785 // Construct a series of synthetic messages for each valid IPC message type, 771 // Construct a series of synthetic messages for each valid IPC message type,
786 // ensuring the router ignores them all. 772 // ensuring the router ignores them all.
787 for (int i = 0; i < LastIPCMsgStart; ++i) { 773 for (int i = 0; i < LastIPCMsgStart; ++i) {
788 const int message_id = i << 16; 774 const int message_id = i << 16;
789 ASSERT_EQ(IPC_MESSAGE_ID_CLASS(message_id), i); 775 ASSERT_EQ(IPC_MESSAGE_ID_CLASS(message_id), i);
790 IPC::Message msg(routing_id, message_id, IPC::Message::PRIORITY_LOW); 776 IPC::Message msg(routing_id, message_id, IPC::Message::PRIORITY_LOW);
791 EXPECT_FALSE(OnSpuriousMessageReceived(msg)) << i; 777 EXPECT_FALSE(OnSpuriousMessageReceived(msg)) << i;
792 } 778 }
793 } 779 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698