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

Side by Side Diff: content/browser/site_instance_impl_unittest.cc

Issue 994803004: Add Clone and disallow copy construction for NavigationEntryImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup Created 5 years, 9 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
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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/compiler_specific.h" 6 #include "base/compiler_specific.h"
7 #include "base/memory/scoped_vector.h" 7 #include "base/memory/scoped_vector.h"
8 #include "base/strings/string16.h" 8 #include "base/strings/string16.h"
9 #include "content/browser/browser_thread_impl.h" 9 #include "content/browser/browser_thread_impl.h"
10 #include "content/browser/browsing_instance.h" 10 #include "content/browser/browsing_instance.h"
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 TestSiteInstance::CreateTestSiteInstance(NULL, &site_delete_counter1, 258 TestSiteInstance::CreateTestSiteInstance(NULL, &site_delete_counter1,
259 &browsing_delete_counter); 259 &browsing_delete_counter);
260 SiteInstanceImpl* instance2 = 260 SiteInstanceImpl* instance2 =
261 TestSiteInstance::CreateTestSiteInstance(NULL, &site_delete_counter2, 261 TestSiteInstance::CreateTestSiteInstance(NULL, &site_delete_counter2,
262 &browsing_delete_counter); 262 &browsing_delete_counter);
263 263
264 NavigationEntryImpl* e1 = new NavigationEntryImpl( 264 NavigationEntryImpl* e1 = new NavigationEntryImpl(
265 instance1, 0, url, Referrer(), base::string16(), ui::PAGE_TRANSITION_LINK, 265 instance1, 0, url, Referrer(), base::string16(), ui::PAGE_TRANSITION_LINK,
266 false); 266 false);
267 // Clone the entry 267 // Clone the entry
268 NavigationEntryImpl* e2 = new NavigationEntryImpl(*e1); 268 NavigationEntryImpl* e2 = e1->Clone();
269 269
270 // Should be able to change the SiteInstance of the cloned entry. 270 // Should be able to change the SiteInstance of the cloned entry.
271 e2->set_site_instance(instance2); 271 e2->set_site_instance(instance2);
272 272
273 // The first SiteInstance should go away after deleting e1, since e2 should 273 // The first SiteInstance should go away after deleting e1, since e2 should
274 // no longer be referencing it. 274 // no longer be referencing it.
275 delete e1; 275 delete e1;
276 EXPECT_EQ(1, site_delete_counter1); 276 EXPECT_EQ(1, site_delete_counter1);
277 EXPECT_EQ(0, site_delete_counter2); 277 EXPECT_EQ(0, site_delete_counter2);
278 278
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 EXPECT_TRUE(instance->GetSiteURL().is_empty()); 797 EXPECT_TRUE(instance->GetSiteURL().is_empty());
798 host.reset(instance->GetProcess()); 798 host.reset(instance->GetProcess());
799 799
800 EXPECT_FALSE(RenderProcessHostImpl::GetProcessHostForSite( 800 EXPECT_FALSE(RenderProcessHostImpl::GetProcessHostForSite(
801 browser_context.get(), GURL())); 801 browser_context.get(), GURL()));
802 802
803 DrainMessageLoops(); 803 DrainMessageLoops();
804 } 804 }
805 805
806 } // namespace content 806 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698