OLD | NEW |
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 "chrome/browser/extensions/extension_process_manager.h" | 5 #include "chrome/browser/extensions/extension_process_manager.h" |
6 #include "chrome/browser/extensions/extension_error_reporter.h" | 6 #include "chrome/browser/extensions/extension_error_reporter.h" |
7 #include "chrome/test/base/testing_profile.h" | 7 #include "chrome/test/base/testing_profile.h" |
8 #include "content/browser/site_instance.h" | 8 #include "content/public/browser/render_process_host.h" |
| 9 #include "content/public/browser/site_instance.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "testing/platform_test.h" | 11 #include "testing/platform_test.h" |
11 | 12 |
12 namespace { | 13 namespace { |
13 | 14 |
14 // make the test a PlatformTest to setup autorelease pools properly on mac | 15 // make the test a PlatformTest to setup autorelease pools properly on mac |
15 class ExtensionProcessManagerTest : public testing::Test { | 16 class ExtensionProcessManagerTest : public testing::Test { |
16 public: | 17 public: |
17 static void SetUpTestCase() { | 18 static void SetUpTestCase() { |
18 ExtensionErrorReporter::Init(false); // no noisy errors | 19 ExtensionErrorReporter::Init(false); // no noisy errors |
(...skipping 19 matching lines...) Expand all Loading... |
38 TestingProfile profile2; | 39 TestingProfile profile2; |
39 scoped_ptr<ExtensionProcessManager> manager2( | 40 scoped_ptr<ExtensionProcessManager> manager2( |
40 ExtensionProcessManager::Create(&profile2)); | 41 ExtensionProcessManager::Create(&profile2)); |
41 | 42 |
42 // Extensions with common origins ("scheme://id/") should be grouped in the | 43 // Extensions with common origins ("scheme://id/") should be grouped in the |
43 // same SiteInstance. | 44 // same SiteInstance. |
44 GURL ext1_url1("chrome-extension://ext1_id/index.html"); | 45 GURL ext1_url1("chrome-extension://ext1_id/index.html"); |
45 GURL ext1_url2("chrome-extension://ext1_id/monkey/monkey.html"); | 46 GURL ext1_url2("chrome-extension://ext1_id/monkey/monkey.html"); |
46 GURL ext2_url1("chrome-extension://ext2_id/index.html"); | 47 GURL ext2_url1("chrome-extension://ext2_id/index.html"); |
47 | 48 |
48 scoped_refptr<SiteInstance> site11 = | 49 scoped_refptr<content::SiteInstance> site11 = |
49 manager1->GetSiteInstanceForURL(ext1_url1); | 50 manager1->GetSiteInstanceForURL(ext1_url1); |
50 scoped_refptr<SiteInstance> site12 = | 51 scoped_refptr<content::SiteInstance> site12 = |
51 manager1->GetSiteInstanceForURL(ext1_url2); | 52 manager1->GetSiteInstanceForURL(ext1_url2); |
52 EXPECT_EQ(site11, site12); | 53 EXPECT_EQ(site11, site12); |
53 | 54 |
54 scoped_refptr<SiteInstance> site21 = | 55 scoped_refptr<content::SiteInstance> site21 = |
55 manager1->GetSiteInstanceForURL(ext2_url1); | 56 manager1->GetSiteInstanceForURL(ext2_url1); |
56 EXPECT_NE(site11, site21); | 57 EXPECT_NE(site11, site21); |
57 | 58 |
58 scoped_refptr<SiteInstance> other_profile_site = | 59 scoped_refptr<content::SiteInstance> other_profile_site = |
59 manager2->GetSiteInstanceForURL(ext1_url1); | 60 manager2->GetSiteInstanceForURL(ext1_url1); |
60 EXPECT_NE(site11, other_profile_site); | 61 EXPECT_NE(site11, other_profile_site); |
61 } | 62 } |
OLD | NEW |