| OLD | NEW |
| 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/logging.h" | 6 #include "base/logging.h" |
| 7 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 9 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 10 #include "chrome/test/base/test_switches.h" | 10 #include "chrome/test/base/test_switches.h" |
| 11 #include "chrome/test/base/ui_test_utils.h" | 11 #include "chrome/test/base/ui_test_utils.h" |
| 12 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
| 13 #include "content/public/test/browser_test_utils.h" | 13 #include "content/public/test/browser_test_utils.h" |
| 14 #include "extensions/common/switches.h" | 14 #include "extensions/common/switches.h" |
| 15 #include "net/dns/mock_host_resolver.h" | 15 #include "net/dns/mock_host_resolver.h" |
| 16 #include "url/gurl.h" | 16 #include "url/gurl.h" |
| 17 | 17 |
| 18 class ExtensionResourceRequestPolicyTest : public ExtensionApiTest { | 18 class ExtensionResourceRequestPolicyTest : public ExtensionApiTest { |
| 19 protected: | 19 protected: |
| 20 void SetUpCommandLine(CommandLine* command_line) override { | 20 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 21 ExtensionApiTest::SetUpCommandLine(command_line); | 21 ExtensionApiTest::SetUpCommandLine(command_line); |
| 22 command_line->AppendSwitch( | 22 command_line->AppendSwitch( |
| 23 extensions::switches::kAllowLegacyExtensionManifests); | 23 extensions::switches::kAllowLegacyExtensionManifests); |
| 24 } | 24 } |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 // Note, this mostly tests the logic of chrome/renderer/extensions/ | 27 // Note, this mostly tests the logic of chrome/renderer/extensions/ |
| 28 // extension_resource_request_policy.*, but we have it as a browser test so that | 28 // extension_resource_request_policy.*, but we have it as a browser test so that |
| 29 // can make sure it works end-to-end. | 29 // can make sure it works end-to-end. |
| 30 IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, OriginPrivileges) { | 30 IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, OriginPrivileges) { |
| 31 #if defined(OS_WIN) && defined(USE_ASH) | 31 #if defined(OS_WIN) && defined(USE_ASH) |
| 32 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 32 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
| 33 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 33 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 34 switches::kAshBrowserTests)) |
| 34 return; | 35 return; |
| 35 #endif | 36 #endif |
| 36 | 37 |
| 37 host_resolver()->AddRule("*", "127.0.0.1"); | 38 host_resolver()->AddRule("*", "127.0.0.1"); |
| 38 ASSERT_TRUE(test_server()->Start()); | 39 ASSERT_TRUE(test_server()->Start()); |
| 39 ASSERT_TRUE(LoadExtensionWithFlags(test_data_dir_ | 40 ASSERT_TRUE(LoadExtensionWithFlags(test_data_dir_ |
| 40 .AppendASCII("extension_resource_request_policy") | 41 .AppendASCII("extension_resource_request_policy") |
| 41 .AppendASCII("extension"), | 42 .AppendASCII("extension"), |
| 42 // Tests manifest_version 1 behavior, so warnings are expected. | 43 // Tests manifest_version 1 behavior, so warnings are expected. |
| 43 ExtensionBrowserTest::kFlagIgnoreManifestWarnings)); | 44 ExtensionBrowserTest::kFlagIgnoreManifestWarnings)); |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 | 334 |
| 334 #if defined(OS_MACOSX) | 335 #if defined(OS_MACOSX) |
| 335 #define MAYBE_ExtensionAccessibleResources DISABLED_ExtensionAccessibleResources | 336 #define MAYBE_ExtensionAccessibleResources DISABLED_ExtensionAccessibleResources |
| 336 #else | 337 #else |
| 337 #define MAYBE_ExtensionAccessibleResources ExtensionAccessibleResources | 338 #define MAYBE_ExtensionAccessibleResources ExtensionAccessibleResources |
| 338 #endif | 339 #endif |
| 339 IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, | 340 IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, |
| 340 MAYBE_ExtensionAccessibleResources) { | 341 MAYBE_ExtensionAccessibleResources) { |
| 341 ASSERT_TRUE(RunExtensionSubtest("accessible_cer", "main.html")) << message_; | 342 ASSERT_TRUE(RunExtensionSubtest("accessible_cer", "main.html")) << message_; |
| 342 } | 343 } |
| OLD | NEW |