| 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/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 19 matching lines...) Expand all Loading... |
| 30 MOCK_METHOD1(InstantPageRenderViewCreated, | 30 MOCK_METHOD1(InstantPageRenderViewCreated, |
| 31 void(const content::WebContents* contents)); | 31 void(const content::WebContents* contents)); |
| 32 MOCK_METHOD2(InstantSupportDetermined, | 32 MOCK_METHOD2(InstantSupportDetermined, |
| 33 void(const content::WebContents* contents, | 33 void(const content::WebContents* contents, |
| 34 bool supports_instant)); | 34 bool supports_instant)); |
| 35 MOCK_METHOD1(InstantPageRenderViewGone, | 35 MOCK_METHOD1(InstantPageRenderViewGone, |
| 36 void(const content::WebContents* contents)); | 36 void(const content::WebContents* contents)); |
| 37 MOCK_METHOD2(InstantPageAboutToNavigateMainFrame, | 37 MOCK_METHOD2(InstantPageAboutToNavigateMainFrame, |
| 38 void(const content::WebContents* contents, | 38 void(const content::WebContents* contents, |
| 39 const GURL& url)); | 39 const GURL& url)); |
| 40 MOCK_METHOD2(SetSuggestions, | |
| 41 void(const content::WebContents* contents, | |
| 42 const std::vector<InstantSuggestion>& suggestions)); | |
| 43 MOCK_METHOD3(ShowInstantOverlay, | |
| 44 void(const content::WebContents* contents, | |
| 45 int height, | |
| 46 InstantSizeUnits units)); | |
| 47 MOCK_METHOD0(LogDropdownShown, void()); | |
| 48 MOCK_METHOD2(FocusOmnibox, | 40 MOCK_METHOD2(FocusOmnibox, |
| 49 void(const content::WebContents* contents, | 41 void(const content::WebContents* contents, |
| 50 OmniboxFocusState state)); | 42 OmniboxFocusState state)); |
| 51 MOCK_METHOD5(NavigateToURL, | 43 MOCK_METHOD5(NavigateToURL, |
| 52 void(const content::WebContents* contents, | 44 void(const content::WebContents* contents, |
| 53 const GURL& url, | 45 const GURL& url, |
| 54 content::PageTransition transition, | 46 content::PageTransition transition, |
| 55 WindowOpenDisposition disposition, | 47 WindowOpenDisposition disposition, |
| 56 bool is_search_type)); | 48 bool is_search_type)); |
| 57 MOCK_METHOD1(DeleteMostVisitedItem, void(const GURL& url)); | 49 MOCK_METHOD1(DeleteMostVisitedItem, void(const GURL& url)); |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 NavigateAndCommit(GURL(chrome::kChromeSearchLocalNtpUrl)); | 329 NavigateAndCommit(GURL(chrome::kChromeSearchLocalNtpUrl)); |
| 338 process()->sink().ClearMessages(); | 330 process()->sink().ClearMessages(); |
| 339 | 331 |
| 340 // Incognito pages should get these messages. | 332 // Incognito pages should get these messages. |
| 341 page->sender()->Submit(string16()); | 333 page->sender()->Submit(string16()); |
| 342 EXPECT_TRUE(MessageWasSent(ChromeViewMsg_SearchBoxSubmit::ID)); | 334 EXPECT_TRUE(MessageWasSent(ChromeViewMsg_SearchBoxSubmit::ID)); |
| 343 page->sender()->SetOmniboxBounds(gfx::Rect()); | 335 page->sender()->SetOmniboxBounds(gfx::Rect()); |
| 344 EXPECT_TRUE(MessageWasSent(ChromeViewMsg_SearchBoxMarginChange::ID)); | 336 EXPECT_TRUE(MessageWasSent(ChromeViewMsg_SearchBoxMarginChange::ID)); |
| 345 | 337 |
| 346 // Incognito pages should not get any others. | 338 // Incognito pages should not get any others. |
| 347 page->sender()->Update(string16(), 0, 0, false); | |
| 348 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxChange::ID)); | |
| 349 | |
| 350 page->sender()->Cancel(string16()); | |
| 351 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxCancel::ID)); | |
| 352 | |
| 353 page->sender()->SetPopupBounds(gfx::Rect()); | |
| 354 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxPopupResize::ID)); | |
| 355 | |
| 356 page->sender()->SetFontInformation(string16(), 0); | 339 page->sender()->SetFontInformation(string16(), 0); |
| 357 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxFontInformation::ID)); | 340 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxFontInformation::ID)); |
| 358 | 341 |
| 359 page->sender()->SendAutocompleteResults( | |
| 360 std::vector<InstantAutocompleteResult>()); | |
| 361 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxAutocompleteResults::ID)); | |
| 362 | |
| 363 page->sender()->UpOrDownKeyPressed(0); | |
| 364 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxUpOrDownKeyPressed::ID)); | |
| 365 | |
| 366 page->sender()->EscKeyPressed(); | |
| 367 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxEscKeyPressed::ID)); | |
| 368 | |
| 369 page->sender()->CancelSelection(string16(), 0, 0, false); | |
| 370 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxCancelSelection::ID)); | |
| 371 | |
| 372 page->sender()->SendThemeBackgroundInfo(ThemeBackgroundInfo()); | 342 page->sender()->SendThemeBackgroundInfo(ThemeBackgroundInfo()); |
| 373 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxThemeChanged::ID)); | 343 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxThemeChanged::ID)); |
| 374 | 344 |
| 375 page->sender()->SetDisplayInstantResults(false); | |
| 376 EXPECT_FALSE(MessageWasSent( | |
| 377 ChromeViewMsg_SearchBoxSetDisplayInstantResults::ID)); | |
| 378 | |
| 379 page->sender()->FocusChanged( | 345 page->sender()->FocusChanged( |
| 380 OMNIBOX_FOCUS_NONE, OMNIBOX_FOCUS_CHANGE_EXPLICIT); | 346 OMNIBOX_FOCUS_NONE, OMNIBOX_FOCUS_CHANGE_EXPLICIT); |
| 381 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxFocusChanged::ID)); | 347 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxFocusChanged::ID)); |
| 382 | 348 |
| 383 page->sender()->SetInputInProgress(false); | 349 page->sender()->SetInputInProgress(false); |
| 384 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxSetInputInProgress::ID)); | 350 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxSetInputInProgress::ID)); |
| 385 | 351 |
| 386 page->sender()->SendMostVisitedItems(std::vector<InstantMostVisitedItem>()); | 352 page->sender()->SendMostVisitedItems(std::vector<InstantMostVisitedItem>()); |
| 387 EXPECT_FALSE(MessageWasSent( | 353 EXPECT_FALSE(MessageWasSent( |
| 388 ChromeViewMsg_SearchBoxMostVisitedItemsChanged::ID)); | 354 ChromeViewMsg_SearchBoxMostVisitedItemsChanged::ID)); |
| 389 | 355 |
| 390 page->sender()->ToggleVoiceSearch(); | 356 page->sender()->ToggleVoiceSearch(); |
| 391 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxToggleVoiceSearch::ID)); | 357 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxToggleVoiceSearch::ID)); |
| 392 } | 358 } |
| OLD | NEW |