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/renderer_host/test_render_view_host.h" | 8 #include "content/browser/renderer_host/test_render_view_host.h" |
9 #include "content/browser/web_contents/navigation_controller_impl.h" | 9 #include "content/browser/web_contents/navigation_controller_impl.h" |
10 #include "content/common/input_messages.h" | 10 #include "content/common/input_messages.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 NavigateAndCommit(url1); | 95 NavigateAndCommit(url1); |
96 controller().LoadURL( | 96 controller().LoadURL( |
97 url2, Referrer(), PAGE_TRANSITION_LINK, std::string()); | 97 url2, Referrer(), PAGE_TRANSITION_LINK, std::string()); |
98 // Simulate the ClosePage call which is normally sent by the net::URLRequest. | 98 // Simulate the ClosePage call which is normally sent by the net::URLRequest. |
99 rvh()->ClosePage(); | 99 rvh()->ClosePage(); |
100 // Needed so that navigations are not suspended on the RVH. | 100 // Needed so that navigations are not suspended on the RVH. |
101 test_rvh()->SendShouldCloseACK(true); | 101 test_rvh()->SendShouldCloseACK(true); |
102 contents()->Stop(); | 102 contents()->Stop(); |
103 controller().Reload(false); | 103 controller().Reload(false); |
104 EXPECT_FALSE(test_rvh()->is_waiting_for_unload_ack_for_testing()); | 104 EXPECT_FALSE(test_rvh()->is_waiting_for_unload_ack()); |
105 } | 105 } |
106 | 106 |
107 // Ensure we do not grant bindings to a process shared with unprivileged views. | 107 // Ensure we do not grant bindings to a process shared with unprivileged views. |
108 TEST_F(RenderViewHostTest, DontGrantBindingsToSharedProcess) { | 108 TEST_F(RenderViewHostTest, DontGrantBindingsToSharedProcess) { |
109 // Create another view in the same process. | 109 // Create another view in the same process. |
110 scoped_ptr<TestWebContents> new_web_contents( | 110 scoped_ptr<TestWebContents> new_web_contents( |
111 TestWebContents::Create(browser_context(), rvh()->GetSiteInstance())); | 111 TestWebContents::Create(browser_context(), rvh()->GetSiteInstance())); |
112 | 112 |
113 rvh()->AllowBindings(BINDINGS_POLICY_WEB_UI); | 113 rvh()->AllowBindings(BINDINGS_POLICY_WEB_UI); |
114 EXPECT_FALSE(rvh()->GetEnabledBindings() & BINDINGS_POLICY_WEB_UI); | 114 EXPECT_FALSE(rvh()->GetEnabledBindings() & BINDINGS_POLICY_WEB_UI); |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 process()->GetID(), file_path, | 293 process()->GetID(), file_path, |
294 base::PLATFORM_FILE_OPEN | | 294 base::PLATFORM_FILE_OPEN | |
295 base::PLATFORM_FILE_READ | | 295 base::PLATFORM_FILE_READ | |
296 base::PLATFORM_FILE_EXCLUSIVE_READ | | 296 base::PLATFORM_FILE_EXCLUSIVE_READ | |
297 base::PLATFORM_FILE_ASYNC); | 297 base::PLATFORM_FILE_ASYNC); |
298 test_rvh()->SendNavigateWithFile(process()->GetID(), url, file_path); | 298 test_rvh()->SendNavigateWithFile(process()->GetID(), url, file_path); |
299 EXPECT_EQ(1, process()->bad_msg_count()); | 299 EXPECT_EQ(1, process()->bad_msg_count()); |
300 } | 300 } |
301 | 301 |
302 } // namespace content | 302 } // namespace content |
OLD | NEW |