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/renderer_host/render_message_filter.h" | 9 #include "content/browser/renderer_host/render_message_filter.h" |
10 #include "content/browser/renderer_host/render_view_host_delegate_view.h" | 10 #include "content/browser/renderer_host/render_view_host_delegate_view.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // . click stop before the page has been commited. | 92 // . click stop before the page has been commited. |
93 // . click reload. | 93 // . click reload. |
94 // . IsWaitingForUnloadACK still returns true, and if the hang monitor fires | 94 // . IsWaitingForUnloadACK still returns true, and if the hang monitor fires |
95 // the contents gets closed. | 95 // the contents gets closed. |
96 | 96 |
97 NavigateAndCommit(url1); | 97 NavigateAndCommit(url1); |
98 controller().LoadURL( | 98 controller().LoadURL( |
99 url2, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); | 99 url2, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); |
100 // Simulate the ClosePage call which is normally sent by the net::URLRequest. | 100 // Simulate the ClosePage call which is normally sent by the net::URLRequest. |
101 rvh()->ClosePage(); | 101 rvh()->ClosePage(); |
102 // Needed so that navigations are not suspended on the RVH. | 102 // Needed so that navigations are not suspended on the RFH. |
103 test_rvh()->SendBeforeUnloadACK(true); | 103 main_test_rfh()->SendBeforeUnloadACK(true); |
104 contents()->Stop(); | 104 contents()->Stop(); |
105 controller().Reload(false); | 105 controller().Reload(false); |
106 EXPECT_FALSE(test_rvh()->IsWaitingForUnloadACK()); | 106 EXPECT_FALSE(main_test_rfh()->IsWaitingForUnloadACK()); |
107 } | 107 } |
108 | 108 |
109 // Ensure we do not grant bindings to a process shared with unprivileged views. | 109 // Ensure we do not grant bindings to a process shared with unprivileged views. |
110 TEST_F(RenderViewHostTest, DontGrantBindingsToSharedProcess) { | 110 TEST_F(RenderViewHostTest, DontGrantBindingsToSharedProcess) { |
111 // Create another view in the same process. | 111 // Create another view in the same process. |
112 scoped_ptr<TestWebContents> new_web_contents( | 112 scoped_ptr<TestWebContents> new_web_contents( |
113 TestWebContents::Create(browser_context(), rvh()->GetSiteInstance())); | 113 TestWebContents::Create(browser_context(), rvh()->GetSiteInstance())); |
114 | 114 |
115 rvh()->AllowBindings(BINDINGS_POLICY_WEB_UI); | 115 rvh()->AllowBindings(BINDINGS_POLICY_WEB_UI); |
116 EXPECT_FALSE(rvh()->GetEnabledBindings() & BINDINGS_POLICY_WEB_UI); | 116 EXPECT_FALSE(rvh()->GetEnabledBindings() & BINDINGS_POLICY_WEB_UI); |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 const std::string data_url = "data:image/gif;base64," | 309 const std::string data_url = "data:image/gif;base64," |
310 "R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="; | 310 "R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="; |
311 | 311 |
312 tester->Reset(); | 312 tester->Reset(); |
313 tester->Test(data_url); | 313 tester->Test(data_url); |
314 EXPECT_EQ(tester->UrlString(), data_url); | 314 EXPECT_EQ(tester->UrlString(), data_url); |
315 EXPECT_TRUE(tester->IsDownloaded()); | 315 EXPECT_TRUE(tester->IsDownloaded()); |
316 } | 316 } |
317 | 317 |
318 } // namespace content | 318 } // namespace content |
OLD | NEW |