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

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

Issue 102593002: Convert string16 to base::string16 in content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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/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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 int browsing_delete_counter = 0; 197 int browsing_delete_counter = 0;
198 const GURL url("test:foo"); 198 const GURL url("test:foo");
199 199
200 // Ensure that instances are deleted when their NavigationEntries are gone. 200 // Ensure that instances are deleted when their NavigationEntries are gone.
201 TestSiteInstance* instance = 201 TestSiteInstance* instance =
202 TestSiteInstance::CreateTestSiteInstance(NULL, &site_delete_counter, 202 TestSiteInstance::CreateTestSiteInstance(NULL, &site_delete_counter,
203 &browsing_delete_counter); 203 &browsing_delete_counter);
204 EXPECT_EQ(0, site_delete_counter); 204 EXPECT_EQ(0, site_delete_counter);
205 205
206 NavigationEntryImpl* e1 = new NavigationEntryImpl( 206 NavigationEntryImpl* e1 = new NavigationEntryImpl(
207 instance, 0, url, Referrer(), string16(), PAGE_TRANSITION_LINK, false); 207 instance, 0, url, Referrer(), base::string16(), PAGE_TRANSITION_LINK,
208 false);
208 209
209 // Redundantly setting e1's SiteInstance shouldn't affect the ref count. 210 // Redundantly setting e1's SiteInstance shouldn't affect the ref count.
210 e1->set_site_instance(instance); 211 e1->set_site_instance(instance);
211 EXPECT_EQ(0, site_delete_counter); 212 EXPECT_EQ(0, site_delete_counter);
212 213
213 // Add a second reference 214 // Add a second reference
214 NavigationEntryImpl* e2 = new NavigationEntryImpl( 215 NavigationEntryImpl* e2 = new NavigationEntryImpl(
215 instance, 0, url, Referrer(), string16(), PAGE_TRANSITION_LINK, false); 216 instance, 0, url, Referrer(), base::string16(), PAGE_TRANSITION_LINK,
217 false);
216 218
217 // Now delete both entries and be sure the SiteInstance goes away. 219 // Now delete both entries and be sure the SiteInstance goes away.
218 delete e1; 220 delete e1;
219 EXPECT_EQ(0, site_delete_counter); 221 EXPECT_EQ(0, site_delete_counter);
220 EXPECT_EQ(0, browsing_delete_counter); 222 EXPECT_EQ(0, browsing_delete_counter);
221 delete e2; 223 delete e2;
222 EXPECT_EQ(1, site_delete_counter); 224 EXPECT_EQ(1, site_delete_counter);
223 // instance is now deleted 225 // instance is now deleted
224 EXPECT_EQ(1, browsing_delete_counter); 226 EXPECT_EQ(1, browsing_delete_counter);
225 // browsing_instance is now deleted 227 // browsing_instance is now deleted
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 const GURL url("test:foo"); 259 const GURL url("test:foo");
258 260
259 SiteInstanceImpl* instance1 = 261 SiteInstanceImpl* instance1 =
260 TestSiteInstance::CreateTestSiteInstance(NULL, &site_delete_counter1, 262 TestSiteInstance::CreateTestSiteInstance(NULL, &site_delete_counter1,
261 &browsing_delete_counter); 263 &browsing_delete_counter);
262 SiteInstanceImpl* instance2 = 264 SiteInstanceImpl* instance2 =
263 TestSiteInstance::CreateTestSiteInstance(NULL, &site_delete_counter2, 265 TestSiteInstance::CreateTestSiteInstance(NULL, &site_delete_counter2,
264 &browsing_delete_counter); 266 &browsing_delete_counter);
265 267
266 NavigationEntryImpl* e1 = new NavigationEntryImpl( 268 NavigationEntryImpl* e1 = new NavigationEntryImpl(
267 instance1, 0, url, Referrer(), string16(), PAGE_TRANSITION_LINK, false); 269 instance1, 0, url, Referrer(), base::string16(), PAGE_TRANSITION_LINK,
270 false);
268 // Clone the entry 271 // Clone the entry
269 NavigationEntryImpl* e2 = new NavigationEntryImpl(*e1); 272 NavigationEntryImpl* e2 = new NavigationEntryImpl(*e1);
270 273
271 // Should be able to change the SiteInstance of the cloned entry. 274 // Should be able to change the SiteInstance of the cloned entry.
272 e2->set_site_instance(instance2); 275 e2->set_site_instance(instance2);
273 276
274 // The first SiteInstance should go away after deleting e1, since e2 should 277 // The first SiteInstance should go away after deleting e1, since e2 should
275 // no longer be referencing it. 278 // no longer be referencing it.
276 delete e1; 279 delete e1;
277 EXPECT_EQ(1, site_delete_counter1); 280 EXPECT_EQ(1, site_delete_counter1);
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 EXPECT_TRUE(instance->GetSiteURL().is_empty()); 753 EXPECT_TRUE(instance->GetSiteURL().is_empty());
751 host.reset(instance->GetProcess()); 754 host.reset(instance->GetProcess());
752 755
753 EXPECT_FALSE(RenderProcessHostImpl::GetProcessHostForSite( 756 EXPECT_FALSE(RenderProcessHostImpl::GetProcessHostForSite(
754 browser_context.get(), GURL())); 757 browser_context.get(), GURL()));
755 758
756 DrainMessageLoops(); 759 DrainMessageLoops();
757 } 760 }
758 761
759 } // namespace content 762 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/session_history_browsertest.cc ('k') | content/browser/site_per_process_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698