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

Side by Side Diff: content/renderer/render_view_browsertest.cc

Issue 1208143002: Move existing kSitePerProcess checks to a policy-oracle object (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@swapped_out_cmdline_checks
Patch Set: Partial fixes to Nasko's comments. Created 5 years, 5 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/memory/shared_memory.h" 9 #include "base/memory/shared_memory.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "base/thread_task_runner_handle.h" 13 #include "base/thread_task_runner_handle.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "base/win/windows_version.h" 15 #include "base/win/windows_version.h"
16 #include "content/child/request_extra_data.h" 16 #include "content/child/request_extra_data.h"
17 #include "content/child/service_worker/service_worker_network_provider.h" 17 #include "content/child/service_worker/service_worker_network_provider.h"
18 #include "content/common/frame_messages.h" 18 #include "content/common/frame_messages.h"
19 #include "content/common/ssl_status_serialization.h" 19 #include "content/common/ssl_status_serialization.h"
20 #include "content/common/view_messages.h" 20 #include "content/common/view_messages.h"
21 #include "content/public/browser/browser_context.h" 21 #include "content/public/browser/browser_context.h"
22 #include "content/public/browser/native_web_keyboard_event.h" 22 #include "content/public/browser/native_web_keyboard_event.h"
23 #include "content/public/browser/web_ui_controller_factory.h" 23 #include "content/public/browser/web_ui_controller_factory.h"
24 #include "content/public/common/bindings_policy.h" 24 #include "content/public/common/bindings_policy.h"
25 #include "content/public/common/content_switches.h" 25 #include "content/public/common/content_switches.h"
26 #include "content/public/common/page_zoom.h" 26 #include "content/public/common/page_zoom.h"
27 #include "content/public/common/site_isolation_policy.h"
27 #include "content/public/common/url_constants.h" 28 #include "content/public/common/url_constants.h"
28 #include "content/public/common/url_utils.h" 29 #include "content/public/common/url_utils.h"
29 #include "content/public/renderer/content_renderer_client.h" 30 #include "content/public/renderer/content_renderer_client.h"
30 #include "content/public/renderer/document_state.h" 31 #include "content/public/renderer/document_state.h"
31 #include "content/public/renderer/navigation_state.h" 32 #include "content/public/renderer/navigation_state.h"
32 #include "content/public/test/browser_test_utils.h" 33 #include "content/public/test/browser_test_utils.h"
33 #include "content/public/test/frame_load_waiter.h" 34 #include "content/public/test/frame_load_waiter.h"
34 #include "content/public/test/render_view_test.h" 35 #include "content/public/test/render_view_test.h"
35 #include "content/public/test/test_utils.h" 36 #include "content/public/test/test_utils.h"
36 #include "content/renderer/accessibility/renderer_accessibility.h" 37 #include "content/renderer/accessibility/renderer_accessibility.h"
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 FrameHostMsg_DidCommitProvisionalLoad::Read(frame_navigate_msg, 758 FrameHostMsg_DidCommitProvisionalLoad::Read(frame_navigate_msg,
758 &commit_load_params); 759 &commit_load_params);
759 EXPECT_NE(GURL("swappedout://"), base::get<0>(commit_load_params).url); 760 EXPECT_NE(GURL("swappedout://"), base::get<0>(commit_load_params).url);
760 } 761 }
761 762
762 // Verify that security origins are replicated properly to RenderFrameProxies 763 // Verify that security origins are replicated properly to RenderFrameProxies
763 // when swapping out. 764 // when swapping out.
764 TEST_F(RenderViewImplTest, OriginReplicationForSwapOut) { 765 TEST_F(RenderViewImplTest, OriginReplicationForSwapOut) {
765 // This test should only run with --site-per-process, since origin 766 // This test should only run with --site-per-process, since origin
766 // replication only happens in that mode. 767 // replication only happens in that mode.
767 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 768 if (!SiteIsolationPolicy::AreAllSitesIsolatedForTesting())
768 switches::kSitePerProcess))
769 return; 769 return;
770 770
771 LoadHTML( 771 LoadHTML(
772 "Hello <iframe src='data:text/html,frame 1'></iframe>" 772 "Hello <iframe src='data:text/html,frame 1'></iframe>"
773 "<iframe src='data:text/html,frame 2'></iframe>"); 773 "<iframe src='data:text/html,frame 2'></iframe>");
774 WebFrame* web_frame = frame()->GetWebFrame(); 774 WebFrame* web_frame = frame()->GetWebFrame();
775 TestRenderFrame* child_frame = static_cast<TestRenderFrame*>( 775 TestRenderFrame* child_frame = static_cast<TestRenderFrame*>(
776 RenderFrame::FromWebFrame(web_frame->firstChild())); 776 RenderFrame::FromWebFrame(web_frame->firstChild()));
777 777
778 // Swap the child frame out and pass a serialized origin to be set for 778 // Swap the child frame out and pass a serialized origin to be set for
(...skipping 1543 matching lines...) Expand 10 before | Expand all | Expand 10 after
2322 FROM_HERE, 2322 FROM_HERE,
2323 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); 2323 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this)));
2324 ExecuteJavaScript("debugger;"); 2324 ExecuteJavaScript("debugger;");
2325 2325
2326 // CloseWhilePaused should resume execution and continue here. 2326 // CloseWhilePaused should resume execution and continue here.
2327 EXPECT_FALSE(IsPaused()); 2327 EXPECT_FALSE(IsPaused());
2328 Detach(); 2328 Detach();
2329 } 2329 }
2330 2330
2331 } // namespace content 2331 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698