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

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

Issue 7346024: Get rid of the ProfileId. It was added for ceee. I reverted the original change, since it led to ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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
« no previous file with comments | « content/browser/browsing_instance.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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-inl.h" 6 #include "base/stl_util-inl.h"
7 #include "base/string16.h" 7 #include "base/string16.h"
8 #include "chrome/test/testing_profile.h" 8 #include "chrome/test/testing_profile.h"
9 #include "content/browser/browser_thread.h" 9 #include "content/browser/browser_thread.h"
10 #include "content/browser/browsing_instance.h" 10 #include "content/browser/browsing_instance.h"
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 // Make sure none of differing privilege processes are mixed. 511 // Make sure none of differing privilege processes are mixed.
512 EXPECT_NE(extension1_instance->GetProcess(), webui1_instance->GetProcess()); 512 EXPECT_NE(extension1_instance->GetProcess(), webui1_instance->GetProcess());
513 513
514 for (size_t i = 0; i < content::kMaxRendererProcessCount; ++i) { 514 for (size_t i = 0; i < content::kMaxRendererProcessCount; ++i) {
515 EXPECT_NE(extension1_instance->GetProcess(), hosts[i]); 515 EXPECT_NE(extension1_instance->GetProcess(), hosts[i]);
516 EXPECT_NE(webui1_instance->GetProcess(), hosts[i]); 516 EXPECT_NE(webui1_instance->GetProcess(), hosts[i]);
517 } 517 }
518 518
519 STLDeleteContainerPointers(hosts.begin(), hosts.end()); 519 STLDeleteContainerPointers(hosts.begin(), hosts.end());
520 } 520 }
521
522 // Test to ensure that profiles that derive from each other share site
523 // information.
524 TEST_F(SiteInstanceTest, GetSiteInstanceMap) {
525 int deleteCounter = 0;
526
527 scoped_ptr<Profile> p1(new TestingProfile());
528 scoped_ptr<Profile> p2(new TestingProfile());
529 scoped_ptr<Profile> p3(new DerivedTestingProfile(p1.get()));
530
531 // In this test, instances 1 and 2 will be deleted automatically when the
532 // SiteInstance objects they return are deleted. However, instance 3 never
533 // returns any SitesIntance objects in this test, so will not be automatically
534 // deleted. It must be deleted manually.
535 TestBrowsingInstance* instance1(new TestBrowsingInstance(p1.get(),
536 &deleteCounter));
537 TestBrowsingInstance* instance2(new TestBrowsingInstance(p2.get(),
538 &deleteCounter));
539 scoped_refptr<TestBrowsingInstance> instance3(
540 new TestBrowsingInstance(p3.get(), &deleteCounter));
541
542 instance1->use_process_per_site = true;
543 instance2->use_process_per_site = true;
544 instance3->use_process_per_site = true;
545
546 // The same profile with the same site.
547 scoped_refptr<SiteInstance> s1a(instance1->GetSiteInstanceForURL(
548 GURL("chrome-extension://baz/bar")));
549 scoped_refptr<SiteInstance> s1b(instance1->GetSiteInstanceForURL(
550 GURL("chrome-extension://baz/bar")));
551 EXPECT_EQ(s1a, s1b);
552
553 // The same profile with different sites.
554 scoped_refptr<SiteInstance> s2a(instance1->GetSiteInstanceForURL(
555 GURL("chrome-extension://baz/bar")));
556 scoped_refptr<SiteInstance> s2b(instance1->GetSiteInstanceForURL(
557 GURL("chrome-extension://foo/boo")));
558 EXPECT_NE(s2a, s2b);
559
560 // The different profiles with the same site.
561 scoped_refptr<SiteInstance> s3a(instance1->GetSiteInstanceForURL(
562 GURL("chrome-extension://baz/bar")));
563 scoped_refptr<SiteInstance> s3b(instance2->GetSiteInstanceForURL(
564 GURL("chrome-extension://baz/bar")));
565 EXPECT_NE(s3a, s3b);
566
567 // The different profiles with different sites.
568 scoped_refptr<SiteInstance> s4a(instance1->GetSiteInstanceForURL(
569 GURL("chrome-extension://baz/bar")));
570 scoped_refptr<SiteInstance> s4b(instance2->GetSiteInstanceForURL(
571 GURL("chrome-extension://foo/boo")));
572 EXPECT_NE(s4a, s4b);
573
574 // The derived profiles with the same site.
575 scoped_refptr<SiteInstance> s5a(instance1->GetSiteInstanceForURL(
576 GURL("chrome-extension://baz/bar")));
577 scoped_refptr<SiteInstance> s5b(instance3->GetSiteInstanceForURL(
578 GURL("chrome-extension://baz/bar")));
579 EXPECT_EQ(s5a, s5b);
580
581 // The derived profiles with the different sites.
582 scoped_refptr<SiteInstance> s6a(instance1->GetSiteInstanceForURL(
583 GURL("chrome-extension://baz/bar")));
584 scoped_refptr<SiteInstance> s6b(instance3->GetSiteInstanceForURL(
585 GURL("chrome-extension://foo/boo")));
586 EXPECT_NE(s6a, s6b);
587 }
OLDNEW
« no previous file with comments | « content/browser/browsing_instance.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698