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/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "content/browser/renderer_host/frame_tree_node.h" | 7 #include "content/browser/renderer_host/frame_tree_node.h" |
8 #include "content/browser/renderer_host/render_view_host_impl.h" | 8 #include "content/browser/renderer_host/render_view_host_impl.h" |
9 #include "content/browser/renderer_host/test_render_view_host.h" | 9 #include "content/browser/renderer_host/test_render_view_host.h" |
10 #include "content/browser/site_instance_impl.h" | 10 #include "content/browser/site_instance_impl.h" |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 } | 331 } |
332 | 332 |
333 // Test to ensure UpdateMaxPageID is working properly. | 333 // Test to ensure UpdateMaxPageID is working properly. |
334 TEST_F(WebContentsImplTest, UpdateMaxPageID) { | 334 TEST_F(WebContentsImplTest, UpdateMaxPageID) { |
335 SiteInstance* instance1 = contents()->GetSiteInstance(); | 335 SiteInstance* instance1 = contents()->GetSiteInstance(); |
336 scoped_refptr<SiteInstance> instance2(SiteInstance::Create(NULL)); | 336 scoped_refptr<SiteInstance> instance2(SiteInstance::Create(NULL)); |
337 | 337 |
338 // Starts at -1. | 338 // Starts at -1. |
339 EXPECT_EQ(-1, contents()->GetMaxPageID()); | 339 EXPECT_EQ(-1, contents()->GetMaxPageID()); |
340 EXPECT_EQ(-1, contents()->GetMaxPageIDForSiteInstance(instance1)); | 340 EXPECT_EQ(-1, contents()->GetMaxPageIDForSiteInstance(instance1)); |
341 EXPECT_EQ(-1, contents()->GetMaxPageIDForSiteInstance(instance2)); | 341 EXPECT_EQ(-1, contents()->GetMaxPageIDForSiteInstance(instance2.get())); |
342 | 342 |
343 // Make sure max_page_id_ is monotonically increasing per SiteInstance. | 343 // Make sure max_page_id_ is monotonically increasing per SiteInstance. |
344 contents()->UpdateMaxPageID(3); | 344 contents()->UpdateMaxPageID(3); |
345 contents()->UpdateMaxPageID(1); | 345 contents()->UpdateMaxPageID(1); |
346 EXPECT_EQ(3, contents()->GetMaxPageID()); | 346 EXPECT_EQ(3, contents()->GetMaxPageID()); |
347 EXPECT_EQ(3, contents()->GetMaxPageIDForSiteInstance(instance1)); | 347 EXPECT_EQ(3, contents()->GetMaxPageIDForSiteInstance(instance1)); |
348 EXPECT_EQ(-1, contents()->GetMaxPageIDForSiteInstance(instance2)); | 348 EXPECT_EQ(-1, contents()->GetMaxPageIDForSiteInstance(instance2.get())); |
349 | 349 |
350 contents()->UpdateMaxPageIDForSiteInstance(instance2, 7); | 350 contents()->UpdateMaxPageIDForSiteInstance(instance2.get(), 7); |
351 EXPECT_EQ(3, contents()->GetMaxPageID()); | 351 EXPECT_EQ(3, contents()->GetMaxPageID()); |
352 EXPECT_EQ(3, contents()->GetMaxPageIDForSiteInstance(instance1)); | 352 EXPECT_EQ(3, contents()->GetMaxPageIDForSiteInstance(instance1)); |
353 EXPECT_EQ(7, contents()->GetMaxPageIDForSiteInstance(instance2)); | 353 EXPECT_EQ(7, contents()->GetMaxPageIDForSiteInstance(instance2.get())); |
354 } | 354 } |
355 | 355 |
356 // Test simple same-SiteInstance navigation. | 356 // Test simple same-SiteInstance navigation. |
357 TEST_F(WebContentsImplTest, SimpleNavigation) { | 357 TEST_F(WebContentsImplTest, SimpleNavigation) { |
358 TestRenderViewHost* orig_rvh = test_rvh(); | 358 TestRenderViewHost* orig_rvh = test_rvh(); |
359 SiteInstance* instance1 = contents()->GetSiteInstance(); | 359 SiteInstance* instance1 = contents()->GetSiteInstance(); |
360 EXPECT_TRUE(contents()->GetPendingRenderViewHost() == NULL); | 360 EXPECT_TRUE(contents()->GetPendingRenderViewHost() == NULL); |
361 | 361 |
362 // Navigate to URL | 362 // Navigate to URL |
363 const GURL url("http://www.google.com"); | 363 const GURL url("http://www.google.com"); |
(...skipping 1746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2110 EXPECT_EQ(0UL, deep_tree->child_at(0)->child_at(0)->child_count()); | 2110 EXPECT_EQ(0UL, deep_tree->child_at(0)->child_at(0)->child_count()); |
2111 | 2111 |
2112 contents()->OnFrameDetached(16, 265); | 2112 contents()->OnFrameDetached(16, 265); |
2113 EXPECT_EQ(4UL, root->child_at(2)->child_count()); | 2113 EXPECT_EQ(4UL, root->child_at(2)->child_count()); |
2114 | 2114 |
2115 contents()->OnFrameDetached(5, 15); | 2115 contents()->OnFrameDetached(5, 15); |
2116 EXPECT_EQ(2UL, root->child_count()); | 2116 EXPECT_EQ(2UL, root->child_count()); |
2117 } | 2117 } |
2118 | 2118 |
2119 } // namespace content | 2119 } // namespace content |
OLD | NEW |