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

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

Issue 22882007: Remove GetActiveEntry usage from chrome/browser/ui. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased on ToT. Created 7 years, 2 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 | Annotate | Revision Log
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_page.h" 5 #include "chrome/browser/ui/search/instant_page.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 ChromeViewMsg_DetermineIfPageSupportsInstant::ID); 146 ChromeViewMsg_DetermineIfPageSupportsInstant::ID);
147 ASSERT_TRUE(message != NULL); 147 ASSERT_TRUE(message != NULL);
148 EXPECT_EQ(web_contents()->GetRoutingID(), message->routing_id()); 148 EXPECT_EQ(web_contents()->GetRoutingID(), message->routing_id());
149 149
150 EXPECT_CALL(delegate, InstantSupportDetermined(web_contents(), true)) 150 EXPECT_CALL(delegate, InstantSupportDetermined(web_contents(), true))
151 .Times(1); 151 .Times(1);
152 152
153 // Assume the page supports instant. Invoke the message reply handler to make 153 // Assume the page supports instant. Invoke the message reply handler to make
154 // sure the InstantPage is notified about the instant support state. 154 // sure the InstantPage is notified about the instant support state.
155 const content::NavigationEntry* entry = 155 const content::NavigationEntry* entry =
156 web_contents()->GetController().GetActiveEntry(); 156 web_contents()->GetController().GetVisibleEntry();
157 EXPECT_TRUE(entry); 157 EXPECT_TRUE(entry);
158 SearchTabHelper::FromWebContents(web_contents())->InstantSupportChanged(true); 158 SearchTabHelper::FromWebContents(web_contents())->InstantSupportChanged(true);
159 EXPECT_TRUE(page->supports_instant()); 159 EXPECT_TRUE(page->supports_instant());
160 } 160 }
161 161
162 TEST_F(InstantPageTest, AppropriateMessagesSentToIncognitoPages) { 162 TEST_F(InstantPageTest, AppropriateMessagesSentToIncognitoPages) {
163 page.reset(new InstantPage(&delegate, "", NULL, true)); 163 page.reset(new InstantPage(&delegate, "", NULL, true));
164 page->SetContents(web_contents()); 164 page->SetContents(web_contents());
165 NavigateAndCommit(GURL(chrome::kChromeSearchLocalNtpUrl)); 165 NavigateAndCommit(GURL(chrome::kChromeSearchLocalNtpUrl));
166 process()->sink().ClearMessages(); 166 process()->sink().ClearMessages();
167 167
168 // Incognito pages should get these messages. 168 // Incognito pages should get these messages.
169 page->sender()->SetOmniboxBounds(gfx::Rect()); 169 page->sender()->SetOmniboxBounds(gfx::Rect());
170 EXPECT_TRUE(MessageWasSent(ChromeViewMsg_SearchBoxMarginChange::ID)); 170 EXPECT_TRUE(MessageWasSent(ChromeViewMsg_SearchBoxMarginChange::ID));
171 page->sender()->ToggleVoiceSearch(); 171 page->sender()->ToggleVoiceSearch();
172 EXPECT_TRUE(MessageWasSent(ChromeViewMsg_SearchBoxToggleVoiceSearch::ID)); 172 EXPECT_TRUE(MessageWasSent(ChromeViewMsg_SearchBoxToggleVoiceSearch::ID));
173 173
174 // Incognito pages should not get any others. 174 // Incognito pages should not get any others.
175 page->sender()->FocusChanged( 175 page->sender()->FocusChanged(
176 OMNIBOX_FOCUS_NONE, OMNIBOX_FOCUS_CHANGE_EXPLICIT); 176 OMNIBOX_FOCUS_NONE, OMNIBOX_FOCUS_CHANGE_EXPLICIT);
177 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxFocusChanged::ID)); 177 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxFocusChanged::ID));
178 178
179 page->sender()->SetInputInProgress(false); 179 page->sender()->SetInputInProgress(false);
180 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxSetInputInProgress::ID)); 180 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxSetInputInProgress::ID));
181 } 181 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/instant_loader.cc ('k') | chrome/browser/ui/search/search_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698