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/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "chrome/common/render_messages.h" | 8 #include "chrome/common/render_messages.h" |
9 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
10 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 10 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
(...skipping 29 matching lines...) Expand all Loading... | |
40 int height, | 40 int height, |
41 InstantSizeUnits units)); | 41 InstantSizeUnits units)); |
42 MOCK_METHOD2(FocusOmnibox, | 42 MOCK_METHOD2(FocusOmnibox, |
43 void(const content::WebContents* contents, | 43 void(const content::WebContents* contents, |
44 OmniboxFocusState state)); | 44 OmniboxFocusState state)); |
45 MOCK_METHOD4(NavigateToURL, | 45 MOCK_METHOD4(NavigateToURL, |
46 void(const content::WebContents* contents, | 46 void(const content::WebContents* contents, |
47 const GURL& url, | 47 const GURL& url, |
48 content::PageTransition transition, | 48 content::PageTransition transition, |
49 WindowOpenDisposition disposition)); | 49 WindowOpenDisposition disposition)); |
50 MOCK_METHOD1(DeleteMostVisitedItem, | 50 MOCK_METHOD1(DeleteMostVisitedItem, void(const GURL& item_url)); |
Jered
2013/05/21 20:18:21
It's a little pedantic, but you could test that On
kmadhusu
2013/05/23 18:26:22
Done.
| |
51 void(InstantRestrictedID most_visited_item_id)); | |
52 MOCK_METHOD1(UndoMostVisitedDeletion, | 51 MOCK_METHOD1(UndoMostVisitedDeletion, |
53 void(InstantRestrictedID most_visited_item_id)); | 52 void(const GURL& most_visited_item_url)); |
54 MOCK_METHOD0(UndoAllMostVisitedDeletions, void()); | 53 MOCK_METHOD0(UndoAllMostVisitedDeletions, void()); |
55 MOCK_METHOD1(InstantPageLoadFailed, void(content::WebContents* contents)); | 54 MOCK_METHOD1(InstantPageLoadFailed, void(content::WebContents* contents)); |
56 }; | 55 }; |
57 | 56 |
58 class FakePage : public InstantPage { | 57 class FakePage : public InstantPage { |
59 public: | 58 public: |
60 FakePage(Delegate* delegate, const std::string& instant_url) | 59 FakePage(Delegate* delegate, const std::string& instant_url) |
61 : InstantPage(delegate, instant_url) { | 60 : InstantPage(delegate, instant_url) { |
62 } | 61 } |
63 virtual ~FakePage() { | 62 virtual ~FakePage() { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
104 page->SetContents(web_contents()); | 103 page->SetContents(web_contents()); |
105 NavigateAndCommit(GURL("http://example.com/")); | 104 NavigateAndCommit(GURL("http://example.com/")); |
106 EXPECT_FALSE(page->IsLocal()); | 105 EXPECT_FALSE(page->IsLocal()); |
107 process()->sink().ClearMessages(); | 106 process()->sink().ClearMessages(); |
108 page->DetermineIfPageSupportsInstant(); | 107 page->DetermineIfPageSupportsInstant(); |
109 const IPC::Message* message = process()->sink().GetFirstMessageMatching( | 108 const IPC::Message* message = process()->sink().GetFirstMessageMatching( |
110 ChromeViewMsg_DetermineIfPageSupportsInstant::ID); | 109 ChromeViewMsg_DetermineIfPageSupportsInstant::ID); |
111 ASSERT_TRUE(message != NULL); | 110 ASSERT_TRUE(message != NULL); |
112 EXPECT_EQ(web_contents()->GetRoutingID(), message->routing_id()); | 111 EXPECT_EQ(web_contents()->GetRoutingID(), message->routing_id()); |
113 } | 112 } |
OLD | NEW |