Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/ui/search/search_ipc_router_policy_impl.h" | 8 #include "chrome/browser/ui/search/search_ipc_router_policy_impl.h" |
| 9 #include "chrome/browser/ui/search/search_tab_helper.h" | 9 #include "chrome/browser/ui/search/search_tab_helper.h" |
| 10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 34 | 34 |
| 35 TEST_F(SearchIPCRouterPolicyTest, SendSetDisplayInstantResults) { | 35 TEST_F(SearchIPCRouterPolicyTest, SendSetDisplayInstantResults) { |
| 36 NavigateAndCommit(GURL("chrome-search://foo/bar")); | 36 NavigateAndCommit(GURL("chrome-search://foo/bar")); |
| 37 SearchTabHelper* search_tab_helper = | 37 SearchTabHelper* search_tab_helper = |
| 38 SearchTabHelper::FromWebContents(web_contents()); | 38 SearchTabHelper::FromWebContents(web_contents()); |
| 39 ASSERT_NE(static_cast<SearchTabHelper*>(NULL), search_tab_helper); | 39 ASSERT_NE(static_cast<SearchTabHelper*>(NULL), search_tab_helper); |
| 40 ASSERT_TRUE(search_tab_helper->ipc_router().policy()-> | 40 ASSERT_TRUE(search_tab_helper->ipc_router().policy()-> |
| 41 ShouldSendSetDisplayInstantResults()); | 41 ShouldSendSetDisplayInstantResults()); |
| 42 } | 42 } |
| 43 | 43 |
| 44 TEST_F(SearchIPCRouterPolicyTest, | 44 TEST_F(SearchIPCRouterPolicyTest, SendSetSuggestionToPrefetch) { |
| 45 DoNotSetDisplayInstantResultsForIncognitoPage) { | |
| 46 NavigateAndCommit(GURL("chrome-search://foo/bar")); | 45 NavigateAndCommit(GURL("chrome-search://foo/bar")); |
| 47 SearchTabHelper* search_tab_helper = | 46 SearchTabHelper* search_tab_helper = |
| 48 SearchTabHelper::FromWebContents(web_contents()); | 47 SearchTabHelper::FromWebContents(web_contents()); |
| 48 ASSERT_NE(static_cast<SearchTabHelper*>(NULL), search_tab_helper); | |
| 49 ASSERT_TRUE(search_tab_helper->ipc_router().policy()-> | |
|
Jered
2013/10/01 17:41:55
Here and below, use EXPECT_ instead of ASSERT_. In
kmadhusu
2013/10/01 18:33:23
Done.
s/ASSERT_TRUE/EXPECT_TRUE/g
s/ASSERT_FALSE/
| |
| 50 ShouldSendSetSuggestionToPrefetch()); | |
| 51 } | |
| 52 | |
| 53 TEST_F(SearchIPCRouterPolicyTest, | |
| 54 DoNotSendSetMessagesForIncognitoPage) { | |
| 55 NavigateAndCommit(GURL("chrome-search://foo/bar")); | |
| 56 SearchTabHelper* search_tab_helper = | |
| 57 SearchTabHelper::FromWebContents(web_contents()); | |
| 49 ASSERT_NE(static_cast<SearchTabHelper*>(NULL), search_tab_helper); | 58 ASSERT_NE(static_cast<SearchTabHelper*>(NULL), search_tab_helper); |
| 50 SearchIPCRouterPolicyImpl* policy = | 59 SearchIPCRouterPolicyImpl* policy = |
| 51 static_cast<SearchIPCRouterPolicyImpl*>( | 60 static_cast<SearchIPCRouterPolicyImpl*>( |
| 52 search_tab_helper->ipc_router().policy()); | 61 search_tab_helper->ipc_router().policy()); |
| 53 policy->set_is_incognito(true); | 62 policy->set_is_incognito(true); |
| 63 | |
| 64 ASSERT_FALSE(search_tab_helper->ipc_router().policy()-> | |
| 65 ShouldSendSetSuggestionToPrefetch()); | |
| 54 ASSERT_FALSE(search_tab_helper->ipc_router().policy()-> | 66 ASSERT_FALSE(search_tab_helper->ipc_router().policy()-> |
| 55 ShouldSendSetDisplayInstantResults()); | 67 ShouldSendSetDisplayInstantResults()); |
| 56 } | 68 } |
| 57 | 69 |
| 58 TEST_F(SearchIPCRouterPolicyTest, SendMostVisitedItems) { | 70 TEST_F(SearchIPCRouterPolicyTest, SendMostVisitedItems) { |
| 59 NavigateAndCommit(GURL(chrome::kChromeSearchLocalNtpUrl)); | 71 NavigateAndCommit(GURL(chrome::kChromeSearchLocalNtpUrl)); |
| 60 SearchTabHelper* search_tab_helper = | 72 SearchTabHelper* search_tab_helper = |
| 61 SearchTabHelper::FromWebContents(web_contents()); | 73 SearchTabHelper::FromWebContents(web_contents()); |
| 62 ASSERT_NE(static_cast<SearchTabHelper*>(NULL), search_tab_helper); | 74 ASSERT_NE(static_cast<SearchTabHelper*>(NULL), search_tab_helper); |
| 63 ASSERT_TRUE(search_tab_helper->ipc_router().policy()-> | 75 ASSERT_TRUE(search_tab_helper->ipc_router().policy()-> |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 113 SearchTabHelper* search_tab_helper = | 125 SearchTabHelper* search_tab_helper = |
| 114 SearchTabHelper::FromWebContents(web_contents()); | 126 SearchTabHelper::FromWebContents(web_contents()); |
| 115 ASSERT_NE(static_cast<SearchTabHelper*>(NULL), search_tab_helper); | 127 ASSERT_NE(static_cast<SearchTabHelper*>(NULL), search_tab_helper); |
| 116 SearchIPCRouterPolicyImpl* policy = | 128 SearchIPCRouterPolicyImpl* policy = |
| 117 static_cast<SearchIPCRouterPolicyImpl*>( | 129 static_cast<SearchIPCRouterPolicyImpl*>( |
| 118 search_tab_helper->ipc_router().policy()); | 130 search_tab_helper->ipc_router().policy()); |
| 119 policy->set_is_incognito(true); | 131 policy->set_is_incognito(true); |
| 120 ASSERT_FALSE(search_tab_helper->ipc_router().policy()-> | 132 ASSERT_FALSE(search_tab_helper->ipc_router().policy()-> |
| 121 ShouldSendThemeBackgroundInfo()); | 133 ShouldSendThemeBackgroundInfo()); |
| 122 } | 134 } |
| OLD | NEW |