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_tab_helper.h" | 5 #include "chrome/browser/ui/search/search_tab_helper.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 138 |
139 SearchTabHelper* search_tab_helper = | 139 SearchTabHelper* search_tab_helper = |
140 SearchTabHelper::FromWebContents(web_contents()); | 140 SearchTabHelper::FromWebContents(web_contents()); |
141 ASSERT_NE(static_cast<SearchTabHelper*>(NULL), search_tab_helper); | 141 ASSERT_NE(static_cast<SearchTabHelper*>(NULL), search_tab_helper); |
142 search_tab_helper->ipc_router().set_delegate_for_testing(mock_delegate()); | 142 search_tab_helper->ipc_router().set_delegate_for_testing(mock_delegate()); |
143 search_tab_helper->DetermineIfPageSupportsInstant(); | 143 search_tab_helper->DetermineIfPageSupportsInstant(); |
144 ASSERT_TRUE(MessageWasSent(ChromeViewMsg_DetermineIfPageSupportsInstant::ID)); | 144 ASSERT_TRUE(MessageWasSent(ChromeViewMsg_DetermineIfPageSupportsInstant::ID)); |
145 | 145 |
146 std::unique_ptr<IPC::Message> response( | 146 std::unique_ptr<IPC::Message> response( |
147 new ChromeViewHostMsg_InstantSupportDetermined( | 147 new ChromeViewHostMsg_InstantSupportDetermined( |
148 web_contents()->GetRoutingID(), | 148 web_contents()->GetRenderViewHost()->GetRoutingID(), |
149 search_tab_helper->ipc_router().page_seq_no_for_testing(), true)); | 149 search_tab_helper->ipc_router().page_seq_no_for_testing(), true)); |
150 search_tab_helper->ipc_router().OnMessageReceived(*response); | 150 search_tab_helper->ipc_router().OnMessageReceived(*response); |
151 } | 151 } |
152 | 152 |
153 TEST_F(SearchTabHelperTest, PageURLDoesntBelongToInstantRenderer) { | 153 TEST_F(SearchTabHelperTest, PageURLDoesntBelongToInstantRenderer) { |
154 // Navigate to a page URL that doesn't belong to Instant renderer. | 154 // Navigate to a page URL that doesn't belong to Instant renderer. |
155 // SearchTabHelper::DeterminerIfPageSupportsInstant() should return | 155 // SearchTabHelper::DeterminerIfPageSupportsInstant() should return |
156 // immediately without dispatching any message to the renderer. | 156 // immediately without dispatching any message to the renderer. |
157 NavigateAndCommit(GURL("http://www.example.com")); | 157 NavigateAndCommit(GURL("http://www.example.com")); |
158 process()->sink().ClearMessages(); | 158 process()->sink().ClearMessages(); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 }; | 338 }; |
339 | 339 |
340 TEST_F(SearchTabHelperTest, TitleIsSetForNTP) { | 340 TEST_F(SearchTabHelperTest, TitleIsSetForNTP) { |
341 TabTitleObserver title_observer(web_contents()); | 341 TabTitleObserver title_observer(web_contents()); |
342 NavigateAndCommit(GURL(chrome::kChromeUINewTabURL)); | 342 NavigateAndCommit(GURL(chrome::kChromeUINewTabURL)); |
343 const base::string16 title = l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE); | 343 const base::string16 title = l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE); |
344 EXPECT_EQ(title, title_observer.title_on_start()); | 344 EXPECT_EQ(title, title_observer.title_on_start()); |
345 EXPECT_EQ(title, title_observer.title_on_commit()); | 345 EXPECT_EQ(title, title_observer.title_on_commit()); |
346 EXPECT_EQ(title, web_contents()->GetTitle()); | 346 EXPECT_EQ(title, web_contents()->GetTitle()); |
347 } | 347 } |
OLD | NEW |