| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 110 |
| 111 bool MessageWasSent(uint32 id) { | 111 bool MessageWasSent(uint32 id) { |
| 112 return process()->sink().GetFirstMessageMatching(id) != NULL; | 112 return process()->sink().GetFirstMessageMatching(id) != NULL; |
| 113 } | 113 } |
| 114 | 114 |
| 115 scoped_ptr<FakePage> page; | 115 scoped_ptr<FakePage> page; |
| 116 FakePageDelegate delegate; | 116 FakePageDelegate delegate; |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 void InstantPageTest::SetUp() { | 119 void InstantPageTest::SetUp() { |
| 120 CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 121 switches::kEnableInstantExtendedAPI); | |
| 122 ChromeRenderViewHostTestHarness::SetUp(); | 120 ChromeRenderViewHostTestHarness::SetUp(); |
| 123 SearchTabHelper::CreateForWebContents(web_contents()); | 121 SearchTabHelper::CreateForWebContents(web_contents()); |
| 124 } | 122 } |
| 125 | 123 |
| 126 TEST_F(InstantPageTest, IsLocal) { | 124 TEST_F(InstantPageTest, IsLocal) { |
| 127 page.reset(new FakePage(&delegate, "", NULL, false)); | 125 page.reset(new FakePage(&delegate, "", NULL, false)); |
| 128 EXPECT_FALSE(page->supports_instant()); | 126 EXPECT_FALSE(page->supports_instant()); |
| 129 EXPECT_FALSE(page->IsLocal()); | 127 EXPECT_FALSE(page->IsLocal()); |
| 130 page->SetContents(web_contents()); | 128 page->SetContents(web_contents()); |
| 131 NavigateAndCommit(GURL(chrome::kChromeSearchLocalNtpUrl)); | 129 NavigateAndCommit(GURL(chrome::kChromeSearchLocalNtpUrl)); |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 EXPECT_TRUE(MessageWasSent(ChromeViewMsg_SearchBoxToggleVoiceSearch::ID)); | 336 EXPECT_TRUE(MessageWasSent(ChromeViewMsg_SearchBoxToggleVoiceSearch::ID)); |
| 339 | 337 |
| 340 // Incognito pages should not get any others. | 338 // Incognito pages should not get any others. |
| 341 page->sender()->FocusChanged( | 339 page->sender()->FocusChanged( |
| 342 OMNIBOX_FOCUS_NONE, OMNIBOX_FOCUS_CHANGE_EXPLICIT); | 340 OMNIBOX_FOCUS_NONE, OMNIBOX_FOCUS_CHANGE_EXPLICIT); |
| 343 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxFocusChanged::ID)); | 341 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxFocusChanged::ID)); |
| 344 | 342 |
| 345 page->sender()->SetInputInProgress(false); | 343 page->sender()->SetInputInProgress(false); |
| 346 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxSetInputInProgress::ID)); | 344 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxSetInputInProgress::ID)); |
| 347 } | 345 } |
| OLD | NEW |