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" |
11 #include "content/browser/renderer_host/render_widget_helper.h" | 11 #include "content/browser/renderer_host/render_widget_helper.h" |
12 #include "content/common/input_messages.h" | 12 #include "content/common/input_messages.h" |
13 #include "content/common/view_messages.h" | 13 #include "content/common/view_messages.h" |
14 #include "content/public/browser/browser_context.h" | 14 #include "content/public/browser/browser_context.h" |
15 #include "content/public/browser/navigation_entry.h" | 15 #include "content/public/browser/navigation_entry.h" |
16 #include "content/public/common/bindings_policy.h" | 16 #include "content/public/common/bindings_policy.h" |
17 #include "content/public/common/drop_data.h" | 17 #include "content/public/common/drop_data.h" |
18 #include "content/public/common/page_transition_types.h" | |
19 #include "content/public/common/url_constants.h" | 18 #include "content/public/common/url_constants.h" |
20 #include "content/public/test/mock_render_process_host.h" | 19 #include "content/public/test/mock_render_process_host.h" |
21 #include "content/test/test_content_browser_client.h" | 20 #include "content/test/test_content_browser_client.h" |
22 #include "content/test/test_render_view_host.h" | 21 #include "content/test/test_render_view_host.h" |
23 #include "content/test/test_web_contents.h" | 22 #include "content/test/test_web_contents.h" |
24 #include "net/base/filename_util.h" | 23 #include "net/base/filename_util.h" |
25 #include "third_party/WebKit/public/web/WebDragOperation.h" | 24 #include "third_party/WebKit/public/web/WebDragOperation.h" |
| 25 #include "ui/base/page_transition_types.h" |
26 | 26 |
27 namespace content { | 27 namespace content { |
28 | 28 |
29 class RenderViewHostTestBrowserClient : public TestContentBrowserClient { | 29 class RenderViewHostTestBrowserClient : public TestContentBrowserClient { |
30 public: | 30 public: |
31 RenderViewHostTestBrowserClient() {} | 31 RenderViewHostTestBrowserClient() {} |
32 virtual ~RenderViewHostTestBrowserClient() {} | 32 virtual ~RenderViewHostTestBrowserClient() {} |
33 | 33 |
34 virtual bool IsHandledURL(const GURL& url) OVERRIDE { | 34 virtual bool IsHandledURL(const GURL& url) OVERRIDE { |
35 return url.scheme() == url::kFileScheme; | 35 return url.scheme() == url::kFileScheme; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // . go to a new page, preferably one that takes a while to resolve, such | 89 // . go to a new page, preferably one that takes a while to resolve, such |
90 // as one on a site that doesn't exist. | 90 // as one on a site that doesn't exist. |
91 // . After this step IsWaitingForUnloadACK returns true on the first RVH. | 91 // . After this step IsWaitingForUnloadACK returns true on the first RVH. |
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(), 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 RVH. |
103 test_rvh()->SendBeforeUnloadACK(true); | 103 test_rvh()->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(test_rvh()->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. |
(...skipping 199 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 |