| 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 23 matching lines...) Expand all Loading... |
| 34 MOCK_METHOD1(OnDeleteMostVisitedItem, void(const GURL& url)); | 34 MOCK_METHOD1(OnDeleteMostVisitedItem, void(const GURL& url)); |
| 35 MOCK_METHOD1(OnUndoMostVisitedDeletion, void(const GURL& url)); | 35 MOCK_METHOD1(OnUndoMostVisitedDeletion, void(const GURL& url)); |
| 36 MOCK_METHOD0(OnUndoAllMostVisitedDeletions, void()); | 36 MOCK_METHOD0(OnUndoAllMostVisitedDeletions, void()); |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 } // namespace | 39 } // namespace |
| 40 | 40 |
| 41 class SearchTabHelperTest : public ChromeRenderViewHostTestHarness { | 41 class SearchTabHelperTest : public ChromeRenderViewHostTestHarness { |
| 42 public: | 42 public: |
| 43 virtual void SetUp() { | 43 virtual void SetUp() { |
| 44 CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 45 switches::kEnableInstantExtendedAPI); | |
| 46 ChromeRenderViewHostTestHarness::SetUp(); | 44 ChromeRenderViewHostTestHarness::SetUp(); |
| 47 SearchTabHelper::CreateForWebContents(web_contents()); | 45 SearchTabHelper::CreateForWebContents(web_contents()); |
| 48 } | 46 } |
| 49 | 47 |
| 50 bool MessageWasSent(uint32 id) { | 48 bool MessageWasSent(uint32 id) { |
| 51 return process()->sink().GetFirstMessageMatching(id) != NULL; | 49 return process()->sink().GetFirstMessageMatching(id) != NULL; |
| 52 } | 50 } |
| 53 | 51 |
| 54 MockSearchIPCRouterDelegate* mock_delegate() { return &delegate_; } | 52 MockSearchIPCRouterDelegate* mock_delegate() { return &delegate_; } |
| 55 | 53 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 EXPECT_CALL(*mock_delegate(), OnInstantSupportDetermined(false)).Times(0); | 95 EXPECT_CALL(*mock_delegate(), OnInstantSupportDetermined(false)).Times(0); |
| 98 | 96 |
| 99 SearchTabHelper* search_tab_helper = | 97 SearchTabHelper* search_tab_helper = |
| 100 SearchTabHelper::FromWebContents(web_contents()); | 98 SearchTabHelper::FromWebContents(web_contents()); |
| 101 ASSERT_NE(static_cast<SearchTabHelper*>(NULL), search_tab_helper); | 99 ASSERT_NE(static_cast<SearchTabHelper*>(NULL), search_tab_helper); |
| 102 search_tab_helper->ipc_router().set_delegate(mock_delegate()); | 100 search_tab_helper->ipc_router().set_delegate(mock_delegate()); |
| 103 search_tab_helper->DetermineIfPageSupportsInstant(); | 101 search_tab_helper->DetermineIfPageSupportsInstant(); |
| 104 ASSERT_FALSE(MessageWasSent( | 102 ASSERT_FALSE(MessageWasSent( |
| 105 ChromeViewMsg_DetermineIfPageSupportsInstant::ID)); | 103 ChromeViewMsg_DetermineIfPageSupportsInstant::ID)); |
| 106 } | 104 } |
| OLD | NEW |