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

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

Issue 2515823002: Remove WebContents::GetRoutingID(). (Closed)
Patch Set: add render_view_host.h include in resource_dispatcher_host_unittest.cc Created 4 years 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/instant_tab.h" 5 #include "chrome/browser/ui/search/instant_tab.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 page.reset(new InstantTab(&delegate, web_contents())); 74 page.reset(new InstantTab(&delegate, web_contents()));
75 EXPECT_FALSE(search_tab()->SupportsInstant()); 75 EXPECT_FALSE(search_tab()->SupportsInstant());
76 page->Init(); 76 page->Init();
77 NavigateAndCommit(GURL("chrome-search://foo/bar")); 77 NavigateAndCommit(GURL("chrome-search://foo/bar"));
78 process()->sink().ClearMessages(); 78 process()->sink().ClearMessages();
79 SearchTabHelper::FromWebContents(web_contents())-> 79 SearchTabHelper::FromWebContents(web_contents())->
80 DetermineIfPageSupportsInstant(); 80 DetermineIfPageSupportsInstant();
81 const IPC::Message* message = process()->sink().GetFirstMessageMatching( 81 const IPC::Message* message = process()->sink().GetFirstMessageMatching(
82 ChromeViewMsg_DetermineIfPageSupportsInstant::ID); 82 ChromeViewMsg_DetermineIfPageSupportsInstant::ID);
83 ASSERT_TRUE(message != NULL); 83 ASSERT_TRUE(message != NULL);
84 EXPECT_EQ(web_contents()->GetRoutingID(), message->routing_id()); 84 EXPECT_EQ(web_contents()->GetRenderViewHost()->GetRoutingID(),
85 message->routing_id());
85 } 86 }
86 87
87 TEST_F(InstantTabTest, PageURLDoesntBelongToInstantRenderer) { 88 TEST_F(InstantTabTest, PageURLDoesntBelongToInstantRenderer) {
88 page.reset(new InstantTab(&delegate, web_contents())); 89 page.reset(new InstantTab(&delegate, web_contents()));
89 EXPECT_FALSE(search_tab()->SupportsInstant()); 90 EXPECT_FALSE(search_tab()->SupportsInstant());
90 NavigateAndCommit(GURL(chrome::kChromeSearchLocalNtpUrl)); 91 NavigateAndCommit(GURL(chrome::kChromeSearchLocalNtpUrl));
91 page->Init(); 92 page->Init();
92 93
93 // Navigate to a page URL that doesn't belong to Instant renderer. 94 // Navigate to a page URL that doesn't belong to Instant renderer.
94 // SearchTabHelper::DeterminerIfPageSupportsInstant() should return 95 // SearchTabHelper::DeterminerIfPageSupportsInstant() should return
(...skipping 16 matching lines...) Expand all
111 page.reset(new InstantTab(&delegate, web_contents())); 112 page.reset(new InstantTab(&delegate, web_contents()));
112 EXPECT_FALSE(search_tab()->SupportsInstant()); 113 EXPECT_FALSE(search_tab()->SupportsInstant());
113 page->Init(); 114 page->Init();
114 NavigateAndCommit(GURL("chrome-search://foo/bar")); 115 NavigateAndCommit(GURL("chrome-search://foo/bar"));
115 process()->sink().ClearMessages(); 116 process()->sink().ClearMessages();
116 SearchTabHelper::FromWebContents(web_contents())-> 117 SearchTabHelper::FromWebContents(web_contents())->
117 DetermineIfPageSupportsInstant(); 118 DetermineIfPageSupportsInstant();
118 const IPC::Message* message = process()->sink().GetFirstMessageMatching( 119 const IPC::Message* message = process()->sink().GetFirstMessageMatching(
119 ChromeViewMsg_DetermineIfPageSupportsInstant::ID); 120 ChromeViewMsg_DetermineIfPageSupportsInstant::ID);
120 ASSERT_TRUE(message != NULL); 121 ASSERT_TRUE(message != NULL);
121 EXPECT_EQ(web_contents()->GetRoutingID(), message->routing_id()); 122 EXPECT_EQ(web_contents()->GetRenderViewHost()->GetRoutingID(),
123 message->routing_id());
122 124
123 EXPECT_CALL(delegate, InstantSupportDetermined(web_contents(), true)); 125 EXPECT_CALL(delegate, InstantSupportDetermined(web_contents(), true));
124 126
125 // Assume the page supports instant. Invoke the message reply handler to make 127 // Assume the page supports instant. Invoke the message reply handler to make
126 // sure the InstantTab is notified about the instant support state. 128 // sure the InstantTab is notified about the instant support state.
127 const content::NavigationEntry* entry = 129 const content::NavigationEntry* entry =
128 web_contents()->GetController().GetLastCommittedEntry(); 130 web_contents()->GetController().GetLastCommittedEntry();
129 EXPECT_TRUE(entry); 131 EXPECT_TRUE(entry);
130 SearchTabHelper::FromWebContents(web_contents())->InstantSupportChanged(true); 132 SearchTabHelper::FromWebContents(web_contents())->InstantSupportChanged(true);
131 EXPECT_TRUE(search_tab()->SupportsInstant()); 133 EXPECT_TRUE(search_tab()->SupportsInstant());
132 } 134 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/blocked_content/popup_blocker_tab_helper.cc ('k') | chrome/browser/ui/search/search_ipc_router_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698