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

Side by Side Diff: content/browser/web_contents/web_contents_impl_unittest.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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "content/browser/frame_host/cross_site_transferring_request.h" 8 #include "content/browser/frame_host/cross_site_transferring_request.h"
9 #include "content/browser/frame_host/interstitial_page_impl.h" 9 #include "content/browser/frame_host/interstitial_page_impl.h"
10 #include "content/browser/frame_host/navigation_entry_impl.h" 10 #include "content/browser/frame_host/navigation_entry_impl.h"
(...skipping 11 matching lines...) Expand all
22 #include "content/public/browser/navigation_details.h" 22 #include "content/public/browser/navigation_details.h"
23 #include "content/public/browser/notification_details.h" 23 #include "content/public/browser/notification_details.h"
24 #include "content/public/browser/notification_source.h" 24 #include "content/public/browser/notification_source.h"
25 #include "content/public/browser/render_widget_host_view.h" 25 #include "content/public/browser/render_widget_host_view.h"
26 #include "content/public/browser/web_contents_delegate.h" 26 #include "content/public/browser/web_contents_delegate.h"
27 #include "content/public/browser/web_contents_observer.h" 27 #include "content/public/browser/web_contents_observer.h"
28 #include "content/public/browser/web_ui_controller.h" 28 #include "content/public/browser/web_ui_controller.h"
29 #include "content/public/common/bindings_policy.h" 29 #include "content/public/common/bindings_policy.h"
30 #include "content/public/common/content_constants.h" 30 #include "content/public/common/content_constants.h"
31 #include "content/public/common/content_switches.h" 31 #include "content/public/common/content_switches.h"
32 #include "content/public/common/site_isolation_policy.h"
32 #include "content/public/common/url_constants.h" 33 #include "content/public/common/url_constants.h"
33 #include "content/public/common/url_utils.h" 34 #include "content/public/common/url_utils.h"
34 #include "content/public/test/mock_render_process_host.h" 35 #include "content/public/test/mock_render_process_host.h"
35 #include "content/public/test/test_utils.h" 36 #include "content/public/test/test_utils.h"
36 #include "content/test/test_content_browser_client.h" 37 #include "content/test/test_content_browser_client.h"
37 #include "content/test/test_content_client.h" 38 #include "content/test/test_content_client.h"
38 #include "content/test/test_render_frame_host.h" 39 #include "content/test/test_render_frame_host.h"
39 #include "content/test/test_render_view_host.h" 40 #include "content/test/test_render_view_host.h"
40 #include "content/test/test_web_contents.h" 41 #include "content/test/test_web_contents.h"
41 #include "testing/gtest/include/gtest/gtest.h" 42 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 2815 matching lines...) Expand 10 before | Expand all | Expand 10 after
2857 // sequence of events that reproduce it are as follows: 2858 // sequence of events that reproduce it are as follows:
2858 // * Navigate top-level frame with one subframe. 2859 // * Navigate top-level frame with one subframe.
2859 // * Subframe navigates more than once before the top-level frame has had a 2860 // * Subframe navigates more than once before the top-level frame has had a
2860 // chance to complete the load. 2861 // chance to complete the load.
2861 // The subframe navigations cause the loading_frames_in_progress_ to drop down 2862 // The subframe navigations cause the loading_frames_in_progress_ to drop down
2862 // to 0, while the loading_progresses_ map is not reset. 2863 // to 0, while the loading_progresses_ map is not reset.
2863 TEST_F(WebContentsImplTest, StartStopEventsBalance) { 2864 TEST_F(WebContentsImplTest, StartStopEventsBalance) {
2864 // The bug manifests itself in regular mode as well, but browser-initiated 2865 // The bug manifests itself in regular mode as well, but browser-initiated
2865 // navigation of subframes is only possible in --site-per-process mode within 2866 // navigation of subframes is only possible in --site-per-process mode within
2866 // unit tests. 2867 // unit tests.
2867 base::CommandLine::ForCurrentProcess()->AppendSwitch( 2868 SiteIsolationPolicy::IsolateAllSitesForTesting(
2868 switches::kSitePerProcess); 2869 base::CommandLine::ForCurrentProcess());
2869 const GURL initial_url("about:blank"); 2870 const GURL initial_url("about:blank");
2870 const GURL main_url("http://www.chromium.org"); 2871 const GURL main_url("http://www.chromium.org");
2871 const GURL foo_url("http://foo.chromium.org"); 2872 const GURL foo_url("http://foo.chromium.org");
2872 const GURL bar_url("http://bar.chromium.org"); 2873 const GURL bar_url("http://bar.chromium.org");
2873 TestRenderFrameHost* orig_rfh = contents()->GetMainFrame(); 2874 TestRenderFrameHost* orig_rfh = contents()->GetMainFrame();
2874 2875
2875 // Use a WebContentsObserver to approximate the behavior of the tab's spinner. 2876 // Use a WebContentsObserver to approximate the behavior of the tab's spinner.
2876 LoadingWebContentsObserver observer(contents()); 2877 LoadingWebContentsObserver observer(contents());
2877 2878
2878 // Navigate the main RenderFrame, simulate the DidStartLoading, and commit. 2879 // Navigate the main RenderFrame, simulate the DidStartLoading, and commit.
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
3183 // Additional changes made by the web contents should propagate as well. 3184 // Additional changes made by the web contents should propagate as well.
3184 RenderViewHostTester::TestOnMessageReceived( 3185 RenderViewHostTester::TestOnMessageReceived(
3185 test_rvh(), 3186 test_rvh(),
3186 FrameHostMsg_DidChangeThemeColor(rfh->GetRoutingID(), SK_ColorGREEN)); 3187 FrameHostMsg_DidChangeThemeColor(rfh->GetRoutingID(), SK_ColorGREEN));
3187 3188
3188 EXPECT_EQ(SK_ColorGREEN, contents()->GetThemeColor()); 3189 EXPECT_EQ(SK_ColorGREEN, contents()->GetThemeColor());
3189 EXPECT_EQ(SK_ColorGREEN, observer.last_theme_color()); 3190 EXPECT_EQ(SK_ColorGREEN, observer.last_theme_color());
3190 } 3191 }
3191 3192
3192 } // namespace content 3193 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698