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/logging.h" | 5 #include "base/logging.h" |
6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
7 #include "content/browser/frame_host/interstitial_page_impl.h" | 7 #include "content/browser/frame_host/interstitial_page_impl.h" |
8 #include "content/browser/frame_host/navigation_entry_impl.h" | 8 #include "content/browser/frame_host/navigation_entry_impl.h" |
9 #include "content/browser/renderer_host/render_view_host_impl.h" | 9 #include "content/browser/renderer_host/render_view_host_impl.h" |
10 #include "content/browser/site_instance_impl.h" | 10 #include "content/browser/site_instance_impl.h" |
(...skipping 2059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2070 // Create another NavigationController. | 2070 // Create another NavigationController. |
2071 GURL url3("http://foo2"); | 2071 GURL url3("http://foo2"); |
2072 scoped_ptr<TestWebContents> other_contents( | 2072 scoped_ptr<TestWebContents> other_contents( |
2073 static_cast<TestWebContents*>(CreateTestWebContents())); | 2073 static_cast<TestWebContents*>(CreateTestWebContents())); |
2074 NavigationControllerImpl& other_controller = other_contents->GetController(); | 2074 NavigationControllerImpl& other_controller = other_contents->GetController(); |
2075 other_contents->NavigateAndCommit(url3); | 2075 other_contents->NavigateAndCommit(url3); |
2076 other_contents->ExpectSetHistoryLengthAndPrune( | 2076 other_contents->ExpectSetHistoryLengthAndPrune( |
2077 NavigationEntryImpl::FromNavigationEntry( | 2077 NavigationEntryImpl::FromNavigationEntry( |
2078 other_controller.GetEntryAtIndex(0))->site_instance(), 1, | 2078 other_controller.GetEntryAtIndex(0))->site_instance(), 1, |
2079 other_controller.GetEntryAtIndex(0)->GetPageID()); | 2079 other_controller.GetEntryAtIndex(0)->GetPageID()); |
2080 other_controller.CopyStateFromAndPrune(&controller()); | 2080 other_controller.CopyStateFromAndPrune(&controller(), false); |
2081 | 2081 |
2082 // The merged controller should only have two entries: url1 and url2. | 2082 // The merged controller should only have two entries: url1 and url2. |
2083 ASSERT_EQ(2, other_controller.GetEntryCount()); | 2083 ASSERT_EQ(2, other_controller.GetEntryCount()); |
2084 EXPECT_EQ(1, other_controller.GetCurrentEntryIndex()); | 2084 EXPECT_EQ(1, other_controller.GetCurrentEntryIndex()); |
2085 EXPECT_EQ(url1, other_controller.GetEntryAtIndex(0)->GetURL()); | 2085 EXPECT_EQ(url1, other_controller.GetEntryAtIndex(0)->GetURL()); |
2086 EXPECT_EQ(url3, other_controller.GetEntryAtIndex(1)->GetURL()); | 2086 EXPECT_EQ(url3, other_controller.GetEntryAtIndex(1)->GetURL()); |
2087 | 2087 |
2088 // And the merged controller shouldn't be showing an interstitial. | 2088 // And the merged controller shouldn't be showing an interstitial. |
2089 EXPECT_FALSE(other_contents->ShowingInterstitialPage()); | 2089 EXPECT_FALSE(other_contents->ShowingInterstitialPage()); |
2090 } | 2090 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2161 TEST_F(WebContentsImplTest, PendingContents) { | 2161 TEST_F(WebContentsImplTest, PendingContents) { |
2162 scoped_ptr<TestWebContents> other_contents( | 2162 scoped_ptr<TestWebContents> other_contents( |
2163 static_cast<TestWebContents*>(CreateTestWebContents())); | 2163 static_cast<TestWebContents*>(CreateTestWebContents())); |
2164 contents()->AddPendingContents(other_contents.get()); | 2164 contents()->AddPendingContents(other_contents.get()); |
2165 int route_id = other_contents->GetRenderViewHost()->GetRoutingID(); | 2165 int route_id = other_contents->GetRenderViewHost()->GetRoutingID(); |
2166 other_contents.reset(); | 2166 other_contents.reset(); |
2167 EXPECT_EQ(NULL, contents()->GetCreatedWindow(route_id)); | 2167 EXPECT_EQ(NULL, contents()->GetCreatedWindow(route_id)); |
2168 } | 2168 } |
2169 | 2169 |
2170 } // namespace content | 2170 } // namespace content |
OLD | NEW |