Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(835)

Side by Side Diff: trunk/src/content/browser/renderer_host/render_view_host_unittest.cc

Issue 12605011: Revert 188912 "Removed static factories for data, ftp, file, and..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/utf_string_conversions.h" 5 #include "base/utf_string_conversions.h"
6 #include "content/browser/child_process_security_policy_impl.h" 6 #include "content/browser/child_process_security_policy_impl.h"
7 #include "content/browser/renderer_host/test_render_view_host.h" 7 #include "content/browser/renderer_host/test_render_view_host.h"
8 #include "content/browser/web_contents/navigation_controller_impl.h" 8 #include "content/browser/web_contents/navigation_controller_impl.h"
9 #include "content/common/view_messages.h" 9 #include "content/common/view_messages.h"
10 #include "content/port/browser/render_view_host_delegate_view.h" 10 #include "content/port/browser/render_view_host_delegate_view.h"
11 #include "content/public/browser/navigation_entry.h" 11 #include "content/public/browser/navigation_entry.h"
12 #include "content/public/common/bindings_policy.h" 12 #include "content/public/common/bindings_policy.h"
13 #include "content/public/common/page_transition_types.h" 13 #include "content/public/common/page_transition_types.h"
14 #include "content/public/common/url_constants.h"
15 #include "content/public/test/mock_render_process_host.h" 14 #include "content/public/test/mock_render_process_host.h"
16 #include "content/test/test_content_browser_client.h"
17 #include "content/test/test_web_contents.h" 15 #include "content/test/test_web_contents.h"
18 #include "net/base/net_util.h" 16 #include "net/base/net_util.h"
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h"
20 #include "webkit/glue/webdropdata.h" 18 #include "webkit/glue/webdropdata.h"
21 19
22 namespace content { 20 namespace content {
23 21
24 class RenderViewHostTestBrowserClient : public TestContentBrowserClient {
25 public:
26 RenderViewHostTestBrowserClient() {}
27 virtual ~RenderViewHostTestBrowserClient() {}
28
29 virtual bool IsHandledURL(const GURL& url) OVERRIDE {
30 return url.scheme() == chrome::kFileScheme;
31 }
32
33 private:
34 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestBrowserClient);
35 };
36
37 class RenderViewHostTest : public RenderViewHostImplTestHarness { 22 class RenderViewHostTest : public RenderViewHostImplTestHarness {
38 public:
39 RenderViewHostTest() : old_browser_client_(NULL) {}
40 virtual ~RenderViewHostTest() {}
41
42 virtual void SetUp() OVERRIDE {
43 RenderViewHostImplTestHarness::SetUp();
44 old_browser_client_ = GetContentClient()->browser();
45 GetContentClient()->set_browser_for_testing(&test_browser_client_);
46 }
47
48 virtual void TearDown() OVERRIDE {
49 GetContentClient()->set_browser_for_testing(old_browser_client_);
50 RenderViewHostImplTestHarness::TearDown();
51 }
52
53 private:
54 RenderViewHostTestBrowserClient test_browser_client_;
55 ContentBrowserClient* old_browser_client_;
56
57 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTest);
58 }; 23 };
59 24
60 // All about URLs reported by the renderer should get rewritten to about:blank. 25 // All about URLs reported by the renderer should get rewritten to about:blank.
61 // See RenderViewHost::OnNavigate for a discussion. 26 // See RenderViewHost::OnNavigate for a discussion.
62 TEST_F(RenderViewHostTest, FilterAbout) { 27 TEST_F(RenderViewHostTest, FilterAbout) {
63 test_rvh()->SendNavigate(1, GURL("about:cache")); 28 test_rvh()->SendNavigate(1, GURL("about:cache"));
64 ASSERT_TRUE(controller().GetActiveEntry()); 29 ASSERT_TRUE(controller().GetActiveEntry());
65 EXPECT_EQ(GURL("about:blank"), controller().GetActiveEntry()->GetURL()); 30 EXPECT_EQ(GURL("about:blank"), controller().GetActiveEntry()->GetURL());
66 } 31 }
67 32
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 // OnInputEventAck() processing. 220 // OnInputEventAck() processing.
256 IPC::Message message(0, ViewHostMsg_HandleInputEvent_ACK::ID, 221 IPC::Message message(0, ViewHostMsg_HandleInputEvent_ACK::ID,
257 IPC::Message::PRIORITY_NORMAL); 222 IPC::Message::PRIORITY_NORMAL);
258 test_rvh()->OnMessageReceived(message); 223 test_rvh()->OnMessageReceived(message);
259 EXPECT_EQ(1, process()->bad_msg_count()); 224 EXPECT_EQ(1, process()->bad_msg_count());
260 } 225 }
261 226
262 #endif 227 #endif
263 228
264 } // namespace content 229 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698