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

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

Issue 10073002: TabContents -> WebContentsImpl, part 11. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: missed a few Created 8 years, 8 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 | Annotate | Revision Log
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 "content/browser/child_process_security_policy_impl.h" 5 #include "content/browser/child_process_security_policy_impl.h"
6 #include "content/browser/renderer_host/test_render_view_host.h" 6 #include "content/browser/renderer_host/test_render_view_host.h"
7 #include "content/browser/web_contents/navigation_controller_impl.h" 7 #include "content/browser/web_contents/navigation_controller_impl.h"
8 #include "content/browser/web_contents/test_web_contents.h" 8 #include "content/browser/web_contents/test_web_contents.h"
9 #include "content/common/view_messages.h" 9 #include "content/common/view_messages.h"
10 #include "content/public/browser/navigation_entry.h" 10 #include "content/public/browser/navigation_entry.h"
(...skipping 18 matching lines...) Expand all
29 } 29 }
30 30
31 // Create a full screen popup RenderWidgetHost and View. 31 // Create a full screen popup RenderWidgetHost and View.
32 TEST_F(RenderViewHostTest, CreateFullscreenWidget) { 32 TEST_F(RenderViewHostTest, CreateFullscreenWidget) {
33 int routing_id = process()->GetNextRoutingID(); 33 int routing_id = process()->GetNextRoutingID();
34 test_rvh()->CreateNewFullscreenWidget(routing_id); 34 test_rvh()->CreateNewFullscreenWidget(routing_id);
35 } 35 }
36 36
37 // Makes sure that RenderViewHost::is_waiting_for_unload_ack_ is false when 37 // Makes sure that RenderViewHost::is_waiting_for_unload_ack_ is false when
38 // reloading a page. If is_waiting_for_unload_ack_ is not false when reloading 38 // reloading a page. If is_waiting_for_unload_ack_ is not false when reloading
39 // the tab may get closed out even though the user pressed the reload button. 39 // the contents may get closed out even though the user pressed the reload
40 // button.
40 TEST_F(RenderViewHostTest, ResetUnloadOnReload) { 41 TEST_F(RenderViewHostTest, ResetUnloadOnReload) {
41 const GURL url1("http://foo1"); 42 const GURL url1("http://foo1");
42 const GURL url2("http://foo2"); 43 const GURL url2("http://foo2");
43 44
44 // This test is for a subtle timing bug. Here's the sequence that triggered 45 // This test is for a subtle timing bug. Here's the sequence that triggered
45 // the bug: 46 // the bug:
46 // . go to a page. 47 // . go to a page.
47 // . go to a new page, preferably one that takes a while to resolve, such 48 // . go to a new page, preferably one that takes a while to resolve, such
48 // as one on a site that doesn't exist. 49 // as one on a site that doesn't exist.
49 // . After this step is_waiting_for_unload_ack_ has been set to true on 50 // . After this step is_waiting_for_unload_ack_ has been set to true on
50 // the first RVH. 51 // the first RVH.
51 // . click stop before the page has been commited. 52 // . click stop before the page has been commited.
52 // . click reload. 53 // . click reload.
53 // . is_waiting_for_unload_ack_ is still true, and the if the hang monitor 54 // . is_waiting_for_unload_ack_ is still true, and the if the hang monitor
54 // fires the tab gets closed. 55 // fires the contents gets closed.
55 56
56 NavigateAndCommit(url1); 57 NavigateAndCommit(url1);
57 controller().LoadURL( 58 controller().LoadURL(
58 url2, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string()); 59 url2, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string());
59 // Simulate the ClosePage call which is normally sent by the net::URLRequest. 60 // Simulate the ClosePage call which is normally sent by the net::URLRequest.
60 rvh()->ClosePage(); 61 rvh()->ClosePage();
61 // Needed so that navigations are not suspended on the RVH. 62 // Needed so that navigations are not suspended on the RVH.
62 test_rvh()->SendShouldCloseACK(true); 63 test_rvh()->SendShouldCloseACK(true);
63 contents()->Stop(); 64 contents()->Stop();
64 controller().Reload(false); 65 controller().Reload(false);
65 EXPECT_FALSE(test_rvh()->is_waiting_for_unload_ack_for_testing()); 66 EXPECT_FALSE(test_rvh()->is_waiting_for_unload_ack_for_testing());
66 } 67 }
67 68
68 // Ensure we do not grant bindings to a process shared with unprivileged views. 69 // Ensure we do not grant bindings to a process shared with unprivileged views.
69 TEST_F(RenderViewHostTest, DontGrantBindingsToSharedProcess) { 70 TEST_F(RenderViewHostTest, DontGrantBindingsToSharedProcess) {
70 // Create another view in the same process. 71 // Create another view in the same process.
71 scoped_ptr<TestWebContents> new_tab( 72 scoped_ptr<TestWebContents> new_web_contents(
72 new TestWebContents(browser_context(), rvh()->GetSiteInstance())); 73 new TestWebContents(browser_context(), rvh()->GetSiteInstance()));
73 74
74 rvh()->AllowBindings(content::BINDINGS_POLICY_WEB_UI); 75 rvh()->AllowBindings(content::BINDINGS_POLICY_WEB_UI);
75 EXPECT_FALSE(rvh()->GetEnabledBindings() & content::BINDINGS_POLICY_WEB_UI); 76 EXPECT_FALSE(rvh()->GetEnabledBindings() & content::BINDINGS_POLICY_WEB_UI);
76 } 77 }
77 78
78 class MockDraggingRenderViewHostDelegateView 79 class MockDraggingRenderViewHostDelegateView
79 : public content::RenderViewHostDelegate::View { 80 : public content::RenderViewHostDelegate::View {
80 public: 81 public:
81 virtual ~MockDraggingRenderViewHostDelegateView() {} 82 virtual ~MockDraggingRenderViewHostDelegateView() {}
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 // the code actually expects it to have at least one int para, this this 206 // the code actually expects it to have at least one int para, this this
206 // bogus message will not fail at de-serialization but should fail in 207 // bogus message will not fail at de-serialization but should fail in
207 // OnMsgInputEventAck() processing. 208 // OnMsgInputEventAck() processing.
208 IPC::Message message(0, ViewHostMsg_HandleInputEvent_ACK::ID, 209 IPC::Message message(0, ViewHostMsg_HandleInputEvent_ACK::ID,
209 IPC::Message::PRIORITY_NORMAL); 210 IPC::Message::PRIORITY_NORMAL);
210 test_rvh()->OnMessageReceived(message); 211 test_rvh()->OnMessageReceived(message);
211 EXPECT_EQ(1, process()->bad_msg_count()); 212 EXPECT_EQ(1, process()->bad_msg_count());
212 } 213 }
213 214
214 #endif 215 #endif
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.cc ('k') | content/browser/renderer_host/render_widget_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698