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

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

Issue 2566583002: Change allowed bindings to be per RenderFrame instead of per RenderView. (Closed)
Patch Set: rebase Created 3 years, 11 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
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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "content/browser/child_process_security_policy_impl.h" 10 #include "content/browser/child_process_security_policy_impl.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 int32_t routing_id = process()->GetNextRoutingID(); 81 int32_t routing_id = process()->GetNextRoutingID();
82 test_rvh()->CreateNewFullscreenWidget(routing_id); 82 test_rvh()->CreateNewFullscreenWidget(routing_id);
83 } 83 }
84 84
85 // Ensure we do not grant bindings to a process shared with unprivileged views. 85 // Ensure we do not grant bindings to a process shared with unprivileged views.
86 TEST_F(RenderViewHostTest, DontGrantBindingsToSharedProcess) { 86 TEST_F(RenderViewHostTest, DontGrantBindingsToSharedProcess) {
87 // Create another view in the same process. 87 // Create another view in the same process.
88 std::unique_ptr<TestWebContents> new_web_contents( 88 std::unique_ptr<TestWebContents> new_web_contents(
89 TestWebContents::Create(browser_context(), rvh()->GetSiteInstance())); 89 TestWebContents::Create(browser_context(), rvh()->GetSiteInstance()));
90 90
91 rvh()->AllowBindings(BINDINGS_POLICY_WEB_UI); 91 main_rfh()->AllowBindings(BINDINGS_POLICY_WEB_UI);
92 EXPECT_FALSE(rvh()->GetEnabledBindings() & BINDINGS_POLICY_WEB_UI); 92 EXPECT_FALSE(rvh()->GetMainFrame()->GetEnabledBindings() &
Charlie Reis 2017/01/19 17:58:55 nit: This one should be main_rfh(), too. :)
Sam McNally 2017/01/19 23:34:09 Done.
93 BINDINGS_POLICY_WEB_UI);
93 } 94 }
94 95
95 class MockDraggingRenderViewHostDelegateView 96 class MockDraggingRenderViewHostDelegateView
96 : public RenderViewHostDelegateView { 97 : public RenderViewHostDelegateView {
97 public: 98 public:
98 ~MockDraggingRenderViewHostDelegateView() override {} 99 ~MockDraggingRenderViewHostDelegateView() override {}
99 void StartDragging(const DropData& drop_data, 100 void StartDragging(const DropData& drop_data,
100 blink::WebDragOperationsMask allowed_ops, 101 blink::WebDragOperationsMask allowed_ops,
101 const gfx::ImageSkia& image, 102 const gfx::ImageSkia& image,
102 const gfx::Vector2d& image_offset, 103 const gfx::Vector2d& image_offset,
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 const std::string data_url = "data:image/gif;base64," 308 const std::string data_url = "data:image/gif;base64,"
308 "R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="; 309 "R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=";
309 310
310 tester->Reset(); 311 tester->Reset();
311 tester->Test(data_url); 312 tester->Test(data_url);
312 EXPECT_EQ(tester->UrlString(), data_url); 313 EXPECT_EQ(tester->UrlString(), data_url);
313 EXPECT_TRUE(tester->IsDownloaded()); 314 EXPECT_TRUE(tester->IsDownloaded());
314 } 315 }
315 316
316 } // namespace content 317 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.cc ('k') | content/browser/security_exploit_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698