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

Side by Side Diff: content/browser/web_contents/web_contents_impl_unittest.cc

Issue 18068017: Change RenderViewHostTestHarness to create BrowserContext after thread startup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
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/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/renderer_host/render_view_host_impl.h" 7 #include "content/browser/renderer_host/render_view_host_impl.h"
8 #include "content/browser/renderer_host/test_render_view_host.h" 8 #include "content/browser/renderer_host/test_render_view_host.h"
9 #include "content/browser/site_instance_impl.h" 9 #include "content/browser/site_instance_impl.h"
10 #include "content/browser/web_contents/frame_tree_node.h" 10 #include "content/browser/web_contents/frame_tree_node.h"
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 SiteInstance* instance1 = contents()->GetSiteInstance(); 555 SiteInstance* instance1 = contents()->GetSiteInstance();
556 556
557 // Navigate to URL. First URL should use first RenderViewHost. 557 // Navigate to URL. First URL should use first RenderViewHost.
558 const GURL url("http://www.google.com"); 558 const GURL url("http://www.google.com");
559 controller().LoadURL( 559 controller().LoadURL(
560 url, Referrer(), PAGE_TRANSITION_TYPED, std::string()); 560 url, Referrer(), PAGE_TRANSITION_TYPED, std::string());
561 contents()->TestDidNavigate(orig_rvh, 1, url, PAGE_TRANSITION_TYPED); 561 contents()->TestDidNavigate(orig_rvh, 1, url, PAGE_TRANSITION_TYPED);
562 562
563 // Open a new contents with the same SiteInstance, navigated to the same site. 563 // Open a new contents with the same SiteInstance, navigated to the same site.
564 scoped_ptr<TestWebContents> contents2( 564 scoped_ptr<TestWebContents> contents2(
565 TestWebContents::Create(browser_context_.get(), instance1)); 565 TestWebContents::Create(browser_context(), instance1));
566 contents2->transition_cross_site = true; 566 contents2->transition_cross_site = true;
567 contents2->GetController().LoadURL(url, Referrer(), 567 contents2->GetController().LoadURL(url, Referrer(),
568 PAGE_TRANSITION_TYPED, 568 PAGE_TRANSITION_TYPED,
569 std::string()); 569 std::string());
570 // Need this page id to be 2 since the site instance is the same (which is the 570 // Need this page id to be 2 since the site instance is the same (which is the
571 // scope of page IDs) and we want to consider this a new page. 571 // scope of page IDs) and we want to consider this a new page.
572 contents2->TestDidNavigate( 572 contents2->TestDidNavigate(
573 contents2->GetRenderViewHost(), 2, url, PAGE_TRANSITION_TYPED); 573 contents2->GetRenderViewHost(), 2, url, PAGE_TRANSITION_TYPED);
574 574
575 // Navigate first contents to a new site. 575 // Navigate first contents to a new site.
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 735
736 // Navigate to URL. 736 // Navigate to URL.
737 const GURL url("http://www.google.com"); 737 const GURL url("http://www.google.com");
738 controller().LoadURL( 738 controller().LoadURL(
739 url, Referrer(), PAGE_TRANSITION_TYPED, std::string()); 739 url, Referrer(), PAGE_TRANSITION_TYPED, std::string());
740 contents()->TestDidNavigate( 740 contents()->TestDidNavigate(
741 orig_rvh, 1, url, PAGE_TRANSITION_TYPED); 741 orig_rvh, 1, url, PAGE_TRANSITION_TYPED);
742 742
743 // Open a related contents to a second site. 743 // Open a related contents to a second site.
744 scoped_ptr<TestWebContents> contents2( 744 scoped_ptr<TestWebContents> contents2(
745 TestWebContents::Create(browser_context_.get(), instance1)); 745 TestWebContents::Create(browser_context(), instance1));
746 contents2->transition_cross_site = true; 746 contents2->transition_cross_site = true;
747 const GURL url2("http://www.yahoo.com"); 747 const GURL url2("http://www.yahoo.com");
748 contents2->GetController().LoadURL(url2, Referrer(), 748 contents2->GetController().LoadURL(url2, Referrer(),
749 PAGE_TRANSITION_TYPED, 749 PAGE_TRANSITION_TYPED,
750 std::string()); 750 std::string());
751 // The first RVH in contents2 isn't live yet, so we shortcut the cross site 751 // The first RVH in contents2 isn't live yet, so we shortcut the cross site
752 // pending. 752 // pending.
753 TestRenderViewHost* rvh2 = static_cast<TestRenderViewHost*>( 753 TestRenderViewHost* rvh2 = static_cast<TestRenderViewHost*>(
754 contents2->GetRenderViewHost()); 754 contents2->GetRenderViewHost());
755 EXPECT_FALSE(contents2->cross_navigation_pending()); 755 EXPECT_FALSE(contents2->cross_navigation_pending());
(...skipping 1462 matching lines...) Expand 10 before | Expand all | Expand 10 after
2218 EXPECT_EQ(0UL, deep_tree->child_at(0)->child_at(0)->child_count()); 2218 EXPECT_EQ(0UL, deep_tree->child_at(0)->child_at(0)->child_count());
2219 2219
2220 contents()->OnFrameDetached(16, 265); 2220 contents()->OnFrameDetached(16, 265);
2221 EXPECT_EQ(4UL, root->child_at(2)->child_count()); 2221 EXPECT_EQ(4UL, root->child_at(2)->child_count());
2222 2222
2223 contents()->OnFrameDetached(5, 15); 2223 contents()->OnFrameDetached(5, 15);
2224 EXPECT_EQ(2UL, root->child_count()); 2224 EXPECT_EQ(2UL, root->child_count());
2225 } 2225 }
2226 2226
2227 } // namespace content 2227 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_delegate_unittest.cc ('k') | content/public/test/test_renderer_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698