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

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

Issue 11931024: Removed static factories for data, ftp, file, and about jobs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync (r198785) Created 7 years, 7 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/input_messages.h" 9 #include "content/common/input_messages.h"
10 #include "content/common/view_messages.h" 10 #include "content/common/view_messages.h"
11 #include "content/port/browser/render_view_host_delegate_view.h" 11 #include "content/port/browser/render_view_host_delegate_view.h"
12 #include "content/public/browser/navigation_entry.h" 12 #include "content/public/browser/navigation_entry.h"
13 #include "content/public/common/bindings_policy.h" 13 #include "content/public/common/bindings_policy.h"
14 #include "content/public/common/page_transition_types.h" 14 #include "content/public/common/page_transition_types.h"
15 #include "content/public/common/url_constants.h"
15 #include "content/public/test/mock_render_process_host.h" 16 #include "content/public/test/mock_render_process_host.h"
17 #include "content/test/test_content_browser_client.h"
16 #include "content/test/test_web_contents.h" 18 #include "content/test/test_web_contents.h"
17 #include "net/base/net_util.h" 19 #include "net/base/net_util.h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h"
19 #include "webkit/glue/webdropdata.h" 21 #include "webkit/glue/webdropdata.h"
20 22
21 namespace content { 23 namespace content {
22 24
25 class RenderViewHostTestBrowserClient : public TestContentBrowserClient {
26 public:
27 RenderViewHostTestBrowserClient() {}
28 virtual ~RenderViewHostTestBrowserClient() {}
29
30 virtual bool IsHandledURL(const GURL& url) OVERRIDE {
31 return url.scheme() == chrome::kFileScheme;
32 }
33
34 private:
35 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestBrowserClient);
36 };
37
23 class RenderViewHostTest : public RenderViewHostImplTestHarness { 38 class RenderViewHostTest : public RenderViewHostImplTestHarness {
39 public:
40 RenderViewHostTest() : old_browser_client_(NULL) {}
41 virtual ~RenderViewHostTest() {}
42
43 virtual void SetUp() OVERRIDE {
44 RenderViewHostImplTestHarness::SetUp();
45 old_browser_client_ = SetBrowserClientForTesting(&test_browser_client_);
46 }
47
48 virtual void TearDown() OVERRIDE {
49 SetBrowserClientForTesting(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);
24 }; 58 };
25 59
26 // All about URLs reported by the renderer should get rewritten to about:blank. 60 // All about URLs reported by the renderer should get rewritten to about:blank.
27 // See RenderViewHost::OnNavigate for a discussion. 61 // See RenderViewHost::OnNavigate for a discussion.
28 TEST_F(RenderViewHostTest, FilterAbout) { 62 TEST_F(RenderViewHostTest, FilterAbout) {
29 test_rvh()->SendNavigate(1, GURL("about:cache")); 63 test_rvh()->SendNavigate(1, GURL("about:cache"));
30 ASSERT_TRUE(controller().GetActiveEntry()); 64 ASSERT_TRUE(controller().GetActiveEntry());
31 EXPECT_EQ(GURL("about:blank"), controller().GetActiveEntry()->GetURL()); 65 EXPECT_EQ(GURL("about:blank"), controller().GetActiveEntry()->GetURL());
32 } 66 }
33 67
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 // OnInputEventAck() processing. 255 // OnInputEventAck() processing.
222 IPC::Message message(0, InputHostMsg_HandleInputEvent_ACK::ID, 256 IPC::Message message(0, InputHostMsg_HandleInputEvent_ACK::ID,
223 IPC::Message::PRIORITY_NORMAL); 257 IPC::Message::PRIORITY_NORMAL);
224 test_rvh()->OnMessageReceived(message); 258 test_rvh()->OnMessageReceived(message);
225 EXPECT_EQ(1, process()->bad_msg_count()); 259 EXPECT_EQ(1, process()->bad_msg_count());
226 } 260 }
227 261
228 #endif 262 #endif
229 263
230 } // namespace content 264 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/child_process_security_policy_unittest.cc ('k') | content/browser/webui/url_data_manager_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698