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/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 14 matching lines...) Expand all Loading... |
25 #include "content/public/browser/notification_source.h" | 25 #include "content/public/browser/notification_source.h" |
26 #include "content/public/browser/render_widget_host_view.h" | 26 #include "content/public/browser/render_widget_host_view.h" |
27 #include "content/public/browser/web_contents_delegate.h" | 27 #include "content/public/browser/web_contents_delegate.h" |
28 #include "content/public/browser/web_contents_observer.h" | 28 #include "content/public/browser/web_contents_observer.h" |
29 #include "content/public/browser/web_ui_controller.h" | 29 #include "content/public/browser/web_ui_controller.h" |
30 #include "content/public/common/bindings_policy.h" | 30 #include "content/public/common/bindings_policy.h" |
31 #include "content/public/common/content_constants.h" | 31 #include "content/public/common/content_constants.h" |
32 #include "content/public/common/content_switches.h" | 32 #include "content/public/common/content_switches.h" |
33 #include "content/public/common/url_constants.h" | 33 #include "content/public/common/url_constants.h" |
34 #include "content/public/common/url_utils.h" | 34 #include "content/public/common/url_utils.h" |
| 35 #include "content/public/test/browser_test_utils.h" |
35 #include "content/public/test/mock_render_process_host.h" | 36 #include "content/public/test/mock_render_process_host.h" |
36 #include "content/public/test/test_utils.h" | 37 #include "content/public/test/test_utils.h" |
37 #include "content/test/test_content_browser_client.h" | 38 #include "content/test/test_content_browser_client.h" |
38 #include "content/test/test_content_client.h" | 39 #include "content/test/test_content_client.h" |
39 #include "content/test/test_render_frame_host.h" | 40 #include "content/test/test_render_frame_host.h" |
40 #include "content/test/test_render_view_host.h" | 41 #include "content/test/test_render_view_host.h" |
41 #include "content/test/test_web_contents.h" | 42 #include "content/test/test_web_contents.h" |
42 #include "testing/gtest/include/gtest/gtest.h" | 43 #include "testing/gtest/include/gtest/gtest.h" |
43 #include "third_party/skia/include/core/SkColor.h" | 44 #include "third_party/skia/include/core/SkColor.h" |
44 | 45 |
(...skipping 2834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2879 // sequence of events that reproduce it are as follows: | 2880 // sequence of events that reproduce it are as follows: |
2880 // * Navigate top-level frame with one subframe. | 2881 // * Navigate top-level frame with one subframe. |
2881 // * Subframe navigates more than once before the top-level frame has had a | 2882 // * Subframe navigates more than once before the top-level frame has had a |
2882 // chance to complete the load. | 2883 // chance to complete the load. |
2883 // The subframe navigations cause the loading_frames_in_progress_ to drop down | 2884 // The subframe navigations cause the loading_frames_in_progress_ to drop down |
2884 // to 0, while the loading_progresses_ map is not reset. | 2885 // to 0, while the loading_progresses_ map is not reset. |
2885 TEST_F(WebContentsImplTest, StartStopEventsBalance) { | 2886 TEST_F(WebContentsImplTest, StartStopEventsBalance) { |
2886 // The bug manifests itself in regular mode as well, but browser-initiated | 2887 // The bug manifests itself in regular mode as well, but browser-initiated |
2887 // navigation of subframes is only possible in --site-per-process mode within | 2888 // navigation of subframes is only possible in --site-per-process mode within |
2888 // unit tests. | 2889 // unit tests. |
2889 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 2890 IsolateAllSitesForTesting(base::CommandLine::ForCurrentProcess()); |
2890 switches::kSitePerProcess); | |
2891 const GURL initial_url("about:blank"); | 2891 const GURL initial_url("about:blank"); |
2892 const GURL main_url("http://www.chromium.org"); | 2892 const GURL main_url("http://www.chromium.org"); |
2893 const GURL foo_url("http://foo.chromium.org"); | 2893 const GURL foo_url("http://foo.chromium.org"); |
2894 const GURL bar_url("http://bar.chromium.org"); | 2894 const GURL bar_url("http://bar.chromium.org"); |
2895 TestRenderFrameHost* orig_rfh = contents()->GetMainFrame(); | 2895 TestRenderFrameHost* orig_rfh = contents()->GetMainFrame(); |
2896 | 2896 |
2897 // Use a WebContentsObserver to approximate the behavior of the tab's spinner. | 2897 // Use a WebContentsObserver to approximate the behavior of the tab's spinner. |
2898 LoadingWebContentsObserver observer(contents()); | 2898 LoadingWebContentsObserver observer(contents()); |
2899 | 2899 |
2900 // Navigate the main RenderFrame, simulate the DidStartLoading, and commit. | 2900 // Navigate the main RenderFrame, simulate the DidStartLoading, and commit. |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3218 MockRenderProcessHost* rph = contents()->GetMainFrame()->GetProcess(); | 3218 MockRenderProcessHost* rph = contents()->GetMainFrame()->GetProcess(); |
3219 EXPECT_EQ(0, rph->bad_msg_count()); | 3219 EXPECT_EQ(0, rph->bad_msg_count()); |
3220 | 3220 |
3221 contents()->OnDidLoadResourceFromMemoryCache( | 3221 contents()->OnDidLoadResourceFromMemoryCache( |
3222 GURL("http://example.test"), "not valid security info", "GET", | 3222 GURL("http://example.test"), "not valid security info", "GET", |
3223 "mime type", RESOURCE_TYPE_MAIN_FRAME); | 3223 "mime type", RESOURCE_TYPE_MAIN_FRAME); |
3224 EXPECT_EQ(1, rph->bad_msg_count()); | 3224 EXPECT_EQ(1, rph->bad_msg_count()); |
3225 } | 3225 } |
3226 | 3226 |
3227 } // namespace content | 3227 } // namespace content |
OLD | NEW |