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

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

Issue 8224023: Don't show URL for pending new navigations initiated by the renderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge conflicts. Created 9 years, 2 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/compiler_specific.h" 5 #include "base/compiler_specific.h"
6 #include "base/stl_util.h" 6 #include "base/stl_util.h"
7 #include "base/string16.h" 7 #include "base/string16.h"
8 #include "content/browser/browser_thread.h" 8 #include "content/browser/browser_thread.h"
9 #include "content/browser/browsing_instance.h" 9 #include "content/browser/browsing_instance.h"
10 #include "content/browser/child_process_security_policy.h" 10 #include "content/browser/child_process_security_policy.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 const GURL url("test:foo"); 181 const GURL url("test:foo");
182 182
183 // Ensure that instances are deleted when their NavigationEntries are gone. 183 // Ensure that instances are deleted when their NavigationEntries are gone.
184 TestSiteInstance* instance = 184 TestSiteInstance* instance =
185 TestSiteInstance::CreateTestSiteInstance(NULL, &siteDeleteCounter, 185 TestSiteInstance::CreateTestSiteInstance(NULL, &siteDeleteCounter,
186 &browsingDeleteCounter); 186 &browsingDeleteCounter);
187 EXPECT_EQ(0, siteDeleteCounter); 187 EXPECT_EQ(0, siteDeleteCounter);
188 188
189 NavigationEntry* e1 = new NavigationEntry(instance, 0, url, GURL(), 189 NavigationEntry* e1 = new NavigationEntry(instance, 0, url, GURL(),
190 string16(), 190 string16(),
191 content::PAGE_TRANSITION_LINK); 191 content::PAGE_TRANSITION_LINK,
192 false);
192 193
193 // Redundantly setting e1's SiteInstance shouldn't affect the ref count. 194 // Redundantly setting e1's SiteInstance shouldn't affect the ref count.
194 e1->set_site_instance(instance); 195 e1->set_site_instance(instance);
195 EXPECT_EQ(0, siteDeleteCounter); 196 EXPECT_EQ(0, siteDeleteCounter);
196 197
197 // Add a second reference 198 // Add a second reference
198 NavigationEntry* e2 = new NavigationEntry(instance, 0, url, 199 NavigationEntry* e2 = new NavigationEntry(instance, 0, url,
199 GURL(), string16(), 200 GURL(), string16(),
200 content::PAGE_TRANSITION_LINK); 201 content::PAGE_TRANSITION_LINK,
202 false);
201 203
202 // Now delete both entries and be sure the SiteInstance goes away. 204 // Now delete both entries and be sure the SiteInstance goes away.
203 delete e1; 205 delete e1;
204 EXPECT_EQ(0, siteDeleteCounter); 206 EXPECT_EQ(0, siteDeleteCounter);
205 EXPECT_EQ(0, browsingDeleteCounter); 207 EXPECT_EQ(0, browsingDeleteCounter);
206 delete e2; 208 delete e2;
207 EXPECT_EQ(1, siteDeleteCounter); 209 EXPECT_EQ(1, siteDeleteCounter);
208 // instance is now deleted 210 // instance is now deleted
209 EXPECT_EQ(1, browsingDeleteCounter); 211 EXPECT_EQ(1, browsingDeleteCounter);
210 // browsing_instance is now deleted 212 // browsing_instance is now deleted
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 247
246 SiteInstance* instance1 = 248 SiteInstance* instance1 =
247 TestSiteInstance::CreateTestSiteInstance(NULL, &siteDeleteCounter1, 249 TestSiteInstance::CreateTestSiteInstance(NULL, &siteDeleteCounter1,
248 &browsingDeleteCounter); 250 &browsingDeleteCounter);
249 SiteInstance* instance2 = 251 SiteInstance* instance2 =
250 TestSiteInstance::CreateTestSiteInstance(NULL, &siteDeleteCounter2, 252 TestSiteInstance::CreateTestSiteInstance(NULL, &siteDeleteCounter2,
251 &browsingDeleteCounter); 253 &browsingDeleteCounter);
252 254
253 NavigationEntry* e1 = new NavigationEntry(instance1, 0, url, GURL(), 255 NavigationEntry* e1 = new NavigationEntry(instance1, 0, url, GURL(),
254 string16(), 256 string16(),
255 content::PAGE_TRANSITION_LINK); 257 content::PAGE_TRANSITION_LINK,
258 false);
256 // Clone the entry 259 // Clone the entry
257 NavigationEntry* e2 = new NavigationEntry(*e1); 260 NavigationEntry* e2 = new NavigationEntry(*e1);
258 261
259 // Should be able to change the SiteInstance of the cloned entry. 262 // Should be able to change the SiteInstance of the cloned entry.
260 e2->set_site_instance(instance2); 263 e2->set_site_instance(instance2);
261 264
262 // The first SiteInstance should go away after deleting e1, since e2 should 265 // The first SiteInstance should go away after deleting e1, since e2 should
263 // no longer be referencing it. 266 // no longer be referencing it.
264 delete e1; 267 delete e1;
265 EXPECT_EQ(1, siteDeleteCounter1); 268 EXPECT_EQ(1, siteDeleteCounter1);
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 // Make sure none of differing privilege processes are mixed. 559 // Make sure none of differing privilege processes are mixed.
557 EXPECT_NE(extension1_instance->GetProcess(), webui1_instance->GetProcess()); 560 EXPECT_NE(extension1_instance->GetProcess(), webui1_instance->GetProcess());
558 561
559 for (size_t i = 0; i < content::kMaxRendererProcessCount; ++i) { 562 for (size_t i = 0; i < content::kMaxRendererProcessCount; ++i) {
560 EXPECT_NE(extension1_instance->GetProcess(), hosts[i]); 563 EXPECT_NE(extension1_instance->GetProcess(), hosts[i]);
561 EXPECT_NE(webui1_instance->GetProcess(), hosts[i]); 564 EXPECT_NE(webui1_instance->GetProcess(), hosts[i]);
562 } 565 }
563 566
564 STLDeleteContainerPointers(hosts.begin(), hosts.end()); 567 STLDeleteContainerPointers(hosts.begin(), hosts.end());
565 } 568 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/html_dialog_tab_contents_delegate.cc ('k') | content/browser/tab_contents/navigation_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698