OLD | NEW |
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/path_service.h" | 5 #include "base/path_service.h" |
6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
7 #include "content/browser/child_process_security_policy_impl.h" | 7 #include "content/browser/child_process_security_policy_impl.h" |
8 #include "content/browser/frame_host/render_frame_host_impl.h" | 8 #include "content/browser/frame_host/render_frame_host_impl.h" |
9 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | |
10 #include "content/browser/renderer_host/render_message_filter.h" | 9 #include "content/browser/renderer_host/render_message_filter.h" |
11 #include "content/browser/renderer_host/render_view_host_delegate_view.h" | 10 #include "content/browser/renderer_host/render_view_host_delegate_view.h" |
12 #include "content/browser/renderer_host/render_widget_helper.h" | 11 #include "content/browser/renderer_host/render_widget_helper.h" |
13 #include "content/common/input_messages.h" | 12 #include "content/common/input_messages.h" |
14 #include "content/common/view_messages.h" | 13 #include "content/common/view_messages.h" |
15 #include "content/public/browser/browser_context.h" | 14 #include "content/public/browser/browser_context.h" |
16 #include "content/public/browser/navigation_entry.h" | 15 #include "content/public/browser/navigation_entry.h" |
17 #include "content/public/common/bindings_policy.h" | 16 #include "content/public/common/bindings_policy.h" |
18 #include "content/public/common/drop_data.h" | 17 #include "content/public/common/drop_data.h" |
19 #include "content/public/common/url_constants.h" | 18 #include "content/public/common/url_constants.h" |
(...skipping 21 matching lines...) Expand all Loading... |
41 }; | 40 }; |
42 | 41 |
43 class RenderViewHostTest : public RenderViewHostImplTestHarness { | 42 class RenderViewHostTest : public RenderViewHostImplTestHarness { |
44 public: | 43 public: |
45 RenderViewHostTest() : old_browser_client_(NULL) {} | 44 RenderViewHostTest() : old_browser_client_(NULL) {} |
46 ~RenderViewHostTest() override {} | 45 ~RenderViewHostTest() override {} |
47 | 46 |
48 void SetUp() override { | 47 void SetUp() override { |
49 RenderViewHostImplTestHarness::SetUp(); | 48 RenderViewHostImplTestHarness::SetUp(); |
50 old_browser_client_ = SetBrowserClientForTesting(&test_browser_client_); | 49 old_browser_client_ = SetBrowserClientForTesting(&test_browser_client_); |
51 gpu_memory_buffer_manager_.reset(new BrowserGpuMemoryBufferManager(0)); | |
52 } | 50 } |
53 | 51 |
54 void TearDown() override { | 52 void TearDown() override { |
55 gpu_memory_buffer_manager_.reset(); | |
56 SetBrowserClientForTesting(old_browser_client_); | 53 SetBrowserClientForTesting(old_browser_client_); |
57 RenderViewHostImplTestHarness::TearDown(); | 54 RenderViewHostImplTestHarness::TearDown(); |
58 } | 55 } |
59 | 56 |
60 private: | 57 private: |
61 RenderViewHostTestBrowserClient test_browser_client_; | 58 RenderViewHostTestBrowserClient test_browser_client_; |
62 ContentBrowserClient* old_browser_client_; | 59 ContentBrowserClient* old_browser_client_; |
63 scoped_ptr<BrowserGpuMemoryBufferManager> gpu_memory_buffer_manager_; | |
64 | 60 |
65 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTest); | 61 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTest); |
66 }; | 62 }; |
67 | 63 |
68 // All about URLs reported by the renderer should get rewritten to about:blank. | 64 // All about URLs reported by the renderer should get rewritten to about:blank. |
69 // See RenderViewHost::OnNavigate for a discussion. | 65 // See RenderViewHost::OnNavigate for a discussion. |
70 TEST_F(RenderViewHostTest, FilterAbout) { | 66 TEST_F(RenderViewHostTest, FilterAbout) { |
71 contents()->GetMainFrame()->SendNavigate(1, GURL("about:cache")); | 67 contents()->GetMainFrame()->SendNavigate(1, GURL("about:cache")); |
72 ASSERT_TRUE(controller().GetVisibleEntry()); | 68 ASSERT_TRUE(controller().GetVisibleEntry()); |
73 EXPECT_EQ(GURL(url::kAboutBlankURL), | 69 EXPECT_EQ(GURL(url::kAboutBlankURL), |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 const std::string data_url = "data:image/gif;base64," | 311 const std::string data_url = "data:image/gif;base64," |
316 "R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="; | 312 "R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="; |
317 | 313 |
318 tester->Reset(); | 314 tester->Reset(); |
319 tester->Test(data_url); | 315 tester->Test(data_url); |
320 EXPECT_EQ(tester->UrlString(), data_url); | 316 EXPECT_EQ(tester->UrlString(), data_url); |
321 EXPECT_TRUE(tester->IsDownloaded()); | 317 EXPECT_TRUE(tester->IsDownloaded()); |
322 } | 318 } |
323 | 319 |
324 } // namespace content | 320 } // namespace content |
OLD | NEW |