| 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/strings/stringprintf.h" | 5 #include "base/strings/stringprintf.h" |
| 6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
| 7 #include "chrome/browser/extensions/api/permissions/permissions_api.h" | 7 #include "chrome/browser/extensions/api/permissions/permissions_api.h" |
| 8 #include "chrome/browser/extensions/extension_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 << message_; | 155 << message_; |
| 156 // Then load targeted extension to make sure its content isn't changed. | 156 // Then load targeted extension to make sure its content isn't changed. |
| 157 ASSERT_TRUE(RunExtensionTest("content_scripts/other_extensions/victim")) | 157 ASSERT_TRUE(RunExtensionTest("content_scripts/other_extensions/victim")) |
| 158 << message_; | 158 << message_; |
| 159 } | 159 } |
| 160 | 160 |
| 161 class ContentScriptCssInjectionTest : public ExtensionApiTest { | 161 class ContentScriptCssInjectionTest : public ExtensionApiTest { |
| 162 protected: | 162 protected: |
| 163 // TODO(rdevlin.cronin): Make a testing switch that looks like FeatureSwitch, | 163 // TODO(rdevlin.cronin): Make a testing switch that looks like FeatureSwitch, |
| 164 // but takes in an optional value so that we don't have to do this. | 164 // but takes in an optional value so that we don't have to do this. |
| 165 virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE { | 165 virtual void SetUpCommandLine(base::CommandLine* command_line) override { |
| 166 ExtensionApiTest::SetUpCommandLine(command_line); | 166 ExtensionApiTest::SetUpCommandLine(command_line); |
| 167 // We change the Webstore URL to be http://cws.com. We need to do this so | 167 // We change the Webstore URL to be http://cws.com. We need to do this so |
| 168 // we can check that css injection is not allowed on the webstore (which | 168 // we can check that css injection is not allowed on the webstore (which |
| 169 // could lead to spoofing). Unfortunately, host_resolver seems to have | 169 // could lead to spoofing). Unfortunately, host_resolver seems to have |
| 170 // problems with redirecting "chrome.google.com" to the test server, so we | 170 // problems with redirecting "chrome.google.com" to the test server, so we |
| 171 // can't use the real Webstore's URL. If this changes, we could clean this | 171 // can't use the real Webstore's URL. If this changes, we could clean this |
| 172 // up. | 172 // up. |
| 173 command_line->AppendSwitchASCII( | 173 command_line->AppendSwitchASCII( |
| 174 switches::kAppsGalleryURL, | 174 switches::kAppsGalleryURL, |
| 175 base::StringPrintf("http://%s", kWebstoreDomain)); | 175 base::StringPrintf("http://%s", kWebstoreDomain)); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 ASSERT_TRUE(StartEmbeddedTestServer()); | 280 ASSERT_TRUE(StartEmbeddedTestServer()); |
| 281 ASSERT_TRUE(RunExtensionTest("content_scripts/permissions")) << message_; | 281 ASSERT_TRUE(RunExtensionTest("content_scripts/permissions")) << message_; |
| 282 } | 282 } |
| 283 | 283 |
| 284 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptBypassPageCSP) { | 284 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptBypassPageCSP) { |
| 285 ASSERT_TRUE(StartEmbeddedTestServer()); | 285 ASSERT_TRUE(StartEmbeddedTestServer()); |
| 286 ASSERT_TRUE(RunExtensionTest("content_scripts/bypass_page_csp")) << message_; | 286 ASSERT_TRUE(RunExtensionTest("content_scripts/bypass_page_csp")) << message_; |
| 287 } | 287 } |
| 288 | 288 |
| 289 } // namespace extensions | 289 } // namespace extensions |
| OLD | NEW |