| 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/search_tab_helper.h" | 5 #include "chrome/browser/ui/search/search_tab_helper.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_ipc_router.h" | 9 #include "chrome/browser/ui/search/search_ipc_router.h" |
| 10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 MOCK_METHOD1(OnInstantSupportDetermined, void(bool supports_instant)); | 30 MOCK_METHOD1(OnInstantSupportDetermined, void(bool supports_instant)); |
| 31 MOCK_METHOD1(OnSetVoiceSearchSupport, void(bool supports_voice_search)); | 31 MOCK_METHOD1(OnSetVoiceSearchSupport, void(bool supports_voice_search)); |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 } // namespace | 34 } // namespace |
| 35 | 35 |
| 36 class SearchTabHelperTest : public ChromeRenderViewHostTestHarness { | 36 class SearchTabHelperTest : public ChromeRenderViewHostTestHarness { |
| 37 public: | 37 public: |
| 38 virtual void SetUp() { | 38 virtual void SetUp() { |
| 39 CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 40 switches::kEnableInstantExtendedAPI); | |
| 41 ChromeRenderViewHostTestHarness::SetUp(); | 39 ChromeRenderViewHostTestHarness::SetUp(); |
| 42 SearchTabHelper::CreateForWebContents(web_contents()); | 40 SearchTabHelper::CreateForWebContents(web_contents()); |
| 43 } | 41 } |
| 44 | 42 |
| 45 bool MessageWasSent(uint32 id) { | 43 bool MessageWasSent(uint32 id) { |
| 46 return process()->sink().GetFirstMessageMatching(id) != NULL; | 44 return process()->sink().GetFirstMessageMatching(id) != NULL; |
| 47 } | 45 } |
| 48 | 46 |
| 49 MockSearchIPCRouterDelegate* mock_delegate() { return &delegate_; } | 47 MockSearchIPCRouterDelegate* mock_delegate() { return &delegate_; } |
| 50 | 48 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 EXPECT_CALL(*mock_delegate(), OnInstantSupportDetermined(false)).Times(0); | 90 EXPECT_CALL(*mock_delegate(), OnInstantSupportDetermined(false)).Times(0); |
| 93 | 91 |
| 94 SearchTabHelper* search_tab_helper = | 92 SearchTabHelper* search_tab_helper = |
| 95 SearchTabHelper::FromWebContents(web_contents()); | 93 SearchTabHelper::FromWebContents(web_contents()); |
| 96 ASSERT_NE(static_cast<SearchTabHelper*>(NULL), search_tab_helper); | 94 ASSERT_NE(static_cast<SearchTabHelper*>(NULL), search_tab_helper); |
| 97 search_tab_helper->ipc_router().set_delegate(mock_delegate()); | 95 search_tab_helper->ipc_router().set_delegate(mock_delegate()); |
| 98 search_tab_helper->DetermineIfPageSupportsInstant(); | 96 search_tab_helper->DetermineIfPageSupportsInstant(); |
| 99 ASSERT_FALSE(MessageWasSent( | 97 ASSERT_FALSE(MessageWasSent( |
| 100 ChromeViewMsg_DetermineIfPageSupportsInstant::ID)); | 98 ChromeViewMsg_DetermineIfPageSupportsInstant::ID)); |
| 101 } | 99 } |
| OLD | NEW |