| Index: chrome/browser/extensions/content_capabilities_browsertest.cc
|
| diff --git a/chrome/browser/extensions/content_capabilities_browsertest.cc b/chrome/browser/extensions/content_capabilities_browsertest.cc
|
| index c0149e2b2e6d7d5e682b102c449e5951fcd66e77..9ec40f460ec1b45a9d2a8b92132274ab38fab368 100644
|
| --- a/chrome/browser/extensions/content_capabilities_browsertest.cc
|
| +++ b/chrome/browser/extensions/content_capabilities_browsertest.cc
|
| @@ -43,6 +43,16 @@ class ContentCapabilitiesTest : public ExtensionApiTest {
|
| base::MakeAbsoluteFilePath(test_extension_dir_.UnpackedPath())));
|
| }
|
|
|
| + void SetUpOnMainThread() override {
|
| + ExtensionApiTest::SetUpOnMainThread();
|
| + base::FilePath test_data;
|
| + EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data));
|
| + embedded_test_server()->ServeFilesFromDirectory(
|
| + test_data.AppendASCII("extensions/content_capabilities"));
|
| + ASSERT_TRUE(embedded_test_server()->Start());
|
| + host_resolver()->AddRule("*", embedded_test_server()->base_url().host());
|
| + }
|
| +
|
| // Builds an extension manifest with the given content_capabilities matches
|
| // and permissions. The extension always has the same (whitelisted) ID.
|
| scoped_refptr<const Extension> LoadExtensionWithCapabilities(
|
| @@ -95,15 +105,6 @@ class ContentCapabilitiesTest : public ExtensionApiTest {
|
| .ReplaceComponents(replacements);
|
| }
|
|
|
| - void InitializeTestServer() {
|
| - base::FilePath test_data;
|
| - EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data));
|
| - embedded_test_server()->ServeFilesFromDirectory(
|
| - test_data.AppendASCII("extensions/content_capabilities"));
|
| - ASSERT_TRUE(embedded_test_server()->Start());
|
| - host_resolver()->AddRule("*", embedded_test_server()->base_url().host());
|
| - }
|
| -
|
| // Run some script in the context of the given origin and in the presence of
|
| // the given extension. This is used to wrap calls into the JS test functions
|
| // defined by
|
| @@ -156,7 +157,6 @@ class ContentCapabilitiesTest : public ExtensionApiTest {
|
| };
|
|
|
| IN_PROC_BROWSER_TEST_F(ContentCapabilitiesTest, NoCapabilities) {
|
| - InitializeTestServer();
|
| scoped_refptr<const Extension> extension = LoadExtensionWithCapabilities(
|
| MakeJSONList("http://foo.example.com/*"), MakeJSONList());
|
| EXPECT_FALSE(
|
| @@ -170,7 +170,6 @@ IN_PROC_BROWSER_TEST_F(ContentCapabilitiesTest, NoCapabilities) {
|
| }
|
|
|
| IN_PROC_BROWSER_TEST_F(ContentCapabilitiesTest, ClipboardRead) {
|
| - InitializeTestServer();
|
| scoped_refptr<const Extension> extension = LoadExtensionWithCapabilities(
|
| MakeJSONList("http://foo.example.com/*"), MakeJSONList("clipboardRead"));
|
| EXPECT_TRUE(
|
| @@ -190,7 +189,6 @@ IN_PROC_BROWSER_TEST_F(ContentCapabilitiesTest, ClipboardRead) {
|
| }
|
|
|
| IN_PROC_BROWSER_TEST_F(ContentCapabilitiesTest, ClipboardWrite) {
|
| - InitializeTestServer();
|
| scoped_refptr<const Extension> extension = LoadExtensionWithCapabilities(
|
| MakeJSONList("http://foo.example.com/*"), MakeJSONList("clipboardWrite"));
|
| EXPECT_TRUE(
|
| @@ -211,7 +209,6 @@ IN_PROC_BROWSER_TEST_F(ContentCapabilitiesTest, ClipboardWrite) {
|
| }
|
|
|
| IN_PROC_BROWSER_TEST_F(ContentCapabilitiesTest, ClipboardReadWrite) {
|
| - InitializeTestServer();
|
| scoped_refptr<const Extension> extension = LoadExtensionWithCapabilities(
|
| MakeJSONList("http://foo.example.com/*"),
|
| MakeJSONList("clipboardRead", "clipboardWrite"));
|
| @@ -228,7 +225,6 @@ IN_PROC_BROWSER_TEST_F(ContentCapabilitiesTest, ClipboardReadWrite) {
|
| }
|
|
|
| IN_PROC_BROWSER_TEST_F(ContentCapabilitiesTest, UnlimitedStorage) {
|
| - InitializeTestServer();
|
| scoped_refptr<const Extension> extension =
|
| LoadExtensionWithCapabilities(MakeJSONList("http://foo.example.com/*"),
|
| MakeJSONList("unlimitedStorage"));
|
| @@ -239,7 +235,6 @@ IN_PROC_BROWSER_TEST_F(ContentCapabilitiesTest, UnlimitedStorage) {
|
| }
|
|
|
| IN_PROC_BROWSER_TEST_F(ContentCapabilitiesTest, WebUnlimitedStorageIsIsolated) {
|
| - InitializeTestServer();
|
| // This extension grants unlimited storage to bar.example.com but does not
|
| // have unlimitedStorage itself.
|
| scoped_refptr<const Extension> extension = LoadExtensionWithCapabilities(
|
| @@ -253,7 +248,6 @@ IN_PROC_BROWSER_TEST_F(ContentCapabilitiesTest, WebUnlimitedStorageIsIsolated) {
|
|
|
| IN_PROC_BROWSER_TEST_F(ContentCapabilitiesTest,
|
| ExtensionUnlimitedStorageIsIsolated) {
|
| - InitializeTestServer();
|
| // This extension has unlimitedStorage but doesn't grant it to foo.example.com
|
| scoped_refptr<const Extension> extension = LoadExtensionWithCapabilities(
|
| MakeJSONList("http://foo.example.com/*"), MakeJSONList("clipboardRead"),
|
|
|