| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 bool MessageWasSent(uint32 id) { | 58 bool MessageWasSent(uint32 id) { |
| 59 return process()->sink().GetFirstMessageMatching(id) != NULL; | 59 return process()->sink().GetFirstMessageMatching(id) != NULL; |
| 60 } | 60 } |
| 61 | 61 |
| 62 scoped_ptr<InstantPage> page; | 62 scoped_ptr<InstantPage> page; |
| 63 FakePageDelegate delegate; | 63 FakePageDelegate delegate; |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 void InstantPageTest::SetUp() { | 66 void InstantPageTest::SetUp() { |
| 67 CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 68 switches::kEnableInstantExtendedAPI); | |
| 69 ChromeRenderViewHostTestHarness::SetUp(); | 67 ChromeRenderViewHostTestHarness::SetUp(); |
| 70 SearchTabHelper::CreateForWebContents(web_contents()); | 68 SearchTabHelper::CreateForWebContents(web_contents()); |
| 71 } | 69 } |
| 72 | 70 |
| 73 TEST_F(InstantPageTest, IsLocal) { | 71 TEST_F(InstantPageTest, IsLocal) { |
| 74 page.reset(new InstantPage(&delegate, "", NULL, false)); | 72 page.reset(new InstantPage(&delegate, "", NULL, false)); |
| 75 EXPECT_FALSE(page->supports_instant()); | 73 EXPECT_FALSE(page->supports_instant()); |
| 76 EXPECT_FALSE(page->IsLocal()); | 74 EXPECT_FALSE(page->IsLocal()); |
| 77 page->SetContents(web_contents()); | 75 page->SetContents(web_contents()); |
| 78 NavigateAndCommit(GURL(chrome::kChromeSearchLocalNtpUrl)); | 76 NavigateAndCommit(GURL(chrome::kChromeSearchLocalNtpUrl)); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 EXPECT_TRUE(MessageWasSent(ChromeViewMsg_SearchBoxToggleVoiceSearch::ID)); | 170 EXPECT_TRUE(MessageWasSent(ChromeViewMsg_SearchBoxToggleVoiceSearch::ID)); |
| 173 | 171 |
| 174 // Incognito pages should not get any others. | 172 // Incognito pages should not get any others. |
| 175 page->sender()->FocusChanged( | 173 page->sender()->FocusChanged( |
| 176 OMNIBOX_FOCUS_NONE, OMNIBOX_FOCUS_CHANGE_EXPLICIT); | 174 OMNIBOX_FOCUS_NONE, OMNIBOX_FOCUS_CHANGE_EXPLICIT); |
| 177 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxFocusChanged::ID)); | 175 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxFocusChanged::ID)); |
| 178 | 176 |
| 179 page->sender()->SetInputInProgress(false); | 177 page->sender()->SetInputInProgress(false); |
| 180 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxSetInputInProgress::ID)); | 178 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxSetInputInProgress::ID)); |
| 181 } | 179 } |
| OLD | NEW |