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 <stdint.h> | 5 #include <stdint.h> |
6 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 2916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2927 EXPECT_EQ(1u, instance->GetRelatedActiveContentsCount()); | 2927 EXPECT_EQ(1u, instance->GetRelatedActiveContentsCount()); |
2928 | 2928 |
2929 // Navigate to a URL in a different site. | 2929 // Navigate to a URL in a different site. |
2930 const GURL kUrl = GURL("http://b.com"); | 2930 const GURL kUrl = GURL("http://b.com"); |
2931 contents->GetController().LoadURL(kUrl, | 2931 contents->GetController().LoadURL(kUrl, |
2932 Referrer(), | 2932 Referrer(), |
2933 ui::PAGE_TRANSITION_TYPED, | 2933 ui::PAGE_TRANSITION_TYPED, |
2934 std::string()); | 2934 std::string()); |
2935 int entry_id = contents->GetController().GetPendingEntry()->GetUniqueID(); | 2935 int entry_id = contents->GetController().GetPendingEntry()->GetUniqueID(); |
2936 if (IsBrowserSideNavigationEnabled()) | 2936 if (IsBrowserSideNavigationEnabled()) |
2937 contents->GetMainFrame()->PrepareForCommit(); | 2937 main_test_rfh()->PrepareForCommit(); |
ncarter (slow)
2016/09/27 20:47:56
Oh yeah, this isn't safe at all.
| |
2938 EXPECT_TRUE(contents->CrossProcessNavigationPending()); | 2938 EXPECT_TRUE(contents->CrossProcessNavigationPending()); |
2939 EXPECT_EQ(1u, instance->GetRelatedActiveContentsCount()); | 2939 EXPECT_EQ(1u, instance->GetRelatedActiveContentsCount()); |
2940 contents->GetPendingMainFrame()->SendNavigate(1, entry_id, true, kUrl); | 2940 contents->GetPendingMainFrame()->SendNavigate(1, entry_id, true, kUrl); |
2941 EXPECT_EQ(1u, instance->GetRelatedActiveContentsCount()); | 2941 EXPECT_EQ(1u, instance->GetRelatedActiveContentsCount()); |
2942 | 2942 |
2943 contents.reset(); | 2943 contents.reset(); |
2944 EXPECT_EQ(0u, instance->GetRelatedActiveContentsCount()); | 2944 EXPECT_EQ(0u, instance->GetRelatedActiveContentsCount()); |
2945 } | 2945 } |
2946 | 2946 |
2947 // Tests that GetRelatedActiveContentsCount tracks BrowsingInstance changes | 2947 // Tests that GetRelatedActiveContentsCount tracks BrowsingInstance changes |
(...skipping 16 matching lines...) Expand all Loading... | |
2964 contents->NavigateAndCommit(GURL("http://gpu")); | 2964 contents->NavigateAndCommit(GURL("http://gpu")); |
2965 EXPECT_EQ(1u, instance->GetRelatedActiveContentsCount()); | 2965 EXPECT_EQ(1u, instance->GetRelatedActiveContentsCount()); |
2966 | 2966 |
2967 // Navigate to a URL with WebUI. This will change BrowsingInstances. | 2967 // Navigate to a URL with WebUI. This will change BrowsingInstances. |
2968 const GURL kWebUIUrl = GURL("chrome://gpu"); | 2968 const GURL kWebUIUrl = GURL("chrome://gpu"); |
2969 contents->GetController().LoadURL(kWebUIUrl, | 2969 contents->GetController().LoadURL(kWebUIUrl, |
2970 Referrer(), | 2970 Referrer(), |
2971 ui::PAGE_TRANSITION_TYPED, | 2971 ui::PAGE_TRANSITION_TYPED, |
2972 std::string()); | 2972 std::string()); |
2973 int entry_id = contents->GetController().GetPendingEntry()->GetUniqueID(); | 2973 int entry_id = contents->GetController().GetPendingEntry()->GetUniqueID(); |
2974 contents->GetMainFrame()->PrepareForCommit(); | 2974 main_test_rfh()->PrepareForCommit(); |
2975 EXPECT_TRUE(contents->CrossProcessNavigationPending()); | 2975 EXPECT_TRUE(contents->CrossProcessNavigationPending()); |
2976 scoped_refptr<SiteInstance> instance_webui( | 2976 scoped_refptr<SiteInstance> instance_webui( |
2977 contents->GetPendingMainFrame()->GetSiteInstance()); | 2977 contents->GetPendingMainFrame()->GetSiteInstance()); |
2978 EXPECT_FALSE(instance->IsRelatedSiteInstance(instance_webui.get())); | 2978 EXPECT_FALSE(instance->IsRelatedSiteInstance(instance_webui.get())); |
2979 | 2979 |
2980 // At this point, contents still counts for the old BrowsingInstance. | 2980 // At this point, contents still counts for the old BrowsingInstance. |
2981 EXPECT_EQ(1u, instance->GetRelatedActiveContentsCount()); | 2981 EXPECT_EQ(1u, instance->GetRelatedActiveContentsCount()); |
2982 EXPECT_EQ(0u, instance_webui->GetRelatedActiveContentsCount()); | 2982 EXPECT_EQ(0u, instance_webui->GetRelatedActiveContentsCount()); |
2983 | 2983 |
2984 // Commit and contents counts for the new one. | 2984 // Commit and contents counts for the new one. |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3448 // An automatic navigation. | 3448 // An automatic navigation. |
3449 contents()->GetMainFrame()->SendNavigateWithModificationCallback( | 3449 contents()->GetMainFrame()->SendNavigateWithModificationCallback( |
3450 2, 0, true, GURL(url::kAboutBlankURL), base::Bind(SetAsNonUserGesture)); | 3450 2, 0, true, GURL(url::kAboutBlankURL), base::Bind(SetAsNonUserGesture)); |
3451 | 3451 |
3452 EXPECT_EQ(1u, dialog_manager.reset_count()); | 3452 EXPECT_EQ(1u, dialog_manager.reset_count()); |
3453 | 3453 |
3454 contents()->SetJavaScriptDialogManagerForTesting(nullptr); | 3454 contents()->SetJavaScriptDialogManagerForTesting(nullptr); |
3455 } | 3455 } |
3456 | 3456 |
3457 } // namespace content | 3457 } // namespace content |
OLD | NEW |