| 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 "chrome/browser/extensions/extension_apitest.h" | 5 #include "chrome/browser/extensions/extension_apitest.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/extensions/api/test/test_api.h" | 10 #include "chrome/browser/extensions/api/test/test_api.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } | 117 } |
| 118 | 118 |
| 119 bool ExtensionApiTest::RunExtensionTestIncognito(const char* extension_name) { | 119 bool ExtensionApiTest::RunExtensionTestIncognito(const char* extension_name) { |
| 120 return RunExtensionTestImpl( | 120 return RunExtensionTestImpl( |
| 121 extension_name, "", kFlagEnableIncognito | kFlagEnableFileAccess); | 121 extension_name, "", kFlagEnableIncognito | kFlagEnableFileAccess); |
| 122 } | 122 } |
| 123 | 123 |
| 124 bool ExtensionApiTest::RunExtensionTestIgnoreManifestWarnings( | 124 bool ExtensionApiTest::RunExtensionTestIgnoreManifestWarnings( |
| 125 const char* extension_name) { | 125 const char* extension_name) { |
| 126 return RunExtensionTestImpl( | 126 return RunExtensionTestImpl( |
| 127 extension_name, "", kFlagEnableFileAccess | kFlagIgnoreManifestWarnings); | 127 extension_name, "", kFlagIgnoreManifestWarnings); |
| 128 } |
| 129 |
| 130 bool ExtensionApiTest::RunExtensionTestAllowOldManifestVersion( |
| 131 const char* extension_name) { |
| 132 return RunExtensionTestImpl( |
| 133 extension_name, |
| 134 "", |
| 135 kFlagEnableFileAccess | kFlagAllowOldManifestVersions); |
| 128 } | 136 } |
| 129 | 137 |
| 130 bool ExtensionApiTest::RunComponentExtensionTest(const char* extension_name) { | 138 bool ExtensionApiTest::RunComponentExtensionTest(const char* extension_name) { |
| 131 return RunExtensionTestImpl( | 139 return RunExtensionTestImpl( |
| 132 extension_name, "", kFlagEnableFileAccess | kFlagLoadAsComponent); | 140 extension_name, "", kFlagEnableFileAccess | kFlagLoadAsComponent); |
| 133 } | 141 } |
| 134 | 142 |
| 135 bool ExtensionApiTest::RunExtensionTestNoFileAccess( | 143 bool ExtensionApiTest::RunExtensionTestNoFileAccess( |
| 136 const char* extension_name) { | 144 const char* extension_name) { |
| 137 return RunExtensionTestImpl(extension_name, "", kFlagNone); | 145 return RunExtensionTestImpl(extension_name, "", kFlagNone); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 if (load_as_component) { | 195 if (load_as_component) { |
| 188 extension = LoadExtensionAsComponent(extension_path); | 196 extension = LoadExtensionAsComponent(extension_path); |
| 189 } else { | 197 } else { |
| 190 int browser_test_flags = ExtensionBrowserTest::kFlagNone; | 198 int browser_test_flags = ExtensionBrowserTest::kFlagNone; |
| 191 if (flags & kFlagEnableIncognito) | 199 if (flags & kFlagEnableIncognito) |
| 192 browser_test_flags |= ExtensionBrowserTest::kFlagEnableIncognito; | 200 browser_test_flags |= ExtensionBrowserTest::kFlagEnableIncognito; |
| 193 if (flags & kFlagEnableFileAccess) | 201 if (flags & kFlagEnableFileAccess) |
| 194 browser_test_flags |= ExtensionBrowserTest::kFlagEnableFileAccess; | 202 browser_test_flags |= ExtensionBrowserTest::kFlagEnableFileAccess; |
| 195 if (flags & kFlagIgnoreManifestWarnings) | 203 if (flags & kFlagIgnoreManifestWarnings) |
| 196 browser_test_flags |= ExtensionBrowserTest::kFlagIgnoreManifestWarnings; | 204 browser_test_flags |= ExtensionBrowserTest::kFlagIgnoreManifestWarnings; |
| 205 if (flags & kFlagAllowOldManifestVersions) { |
| 206 browser_test_flags |= |
| 207 ExtensionBrowserTest::kFlagAllowOldManifestVersions; |
| 208 } |
| 197 extension = LoadExtensionWithFlags(extension_path, browser_test_flags); | 209 extension = LoadExtensionWithFlags(extension_path, browser_test_flags); |
| 198 } | 210 } |
| 199 if (!extension) { | 211 if (!extension) { |
| 200 message_ = "Failed to load extension."; | 212 message_ = "Failed to load extension."; |
| 201 return false; | 213 return false; |
| 202 } | 214 } |
| 203 } | 215 } |
| 204 | 216 |
| 205 // If there is a page_url to load, navigate it. | 217 // If there is a page_url to load, navigate it. |
| 206 if (!page_url.empty()) { | 218 if (!page_url.empty()) { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 | 313 |
| 302 void PlatformAppApiTest::SetUpCommandLine(CommandLine* command_line) { | 314 void PlatformAppApiTest::SetUpCommandLine(CommandLine* command_line) { |
| 303 ExtensionApiTest::SetUpCommandLine(command_line); | 315 ExtensionApiTest::SetUpCommandLine(command_line); |
| 304 | 316 |
| 305 // If someone is using this class, we're going to insist on management of the | 317 // If someone is using this class, we're going to insist on management of the |
| 306 // relevant flags. If these flags are already set, die. | 318 // relevant flags. If these flags are already set, die. |
| 307 DCHECK(!command_line->HasSwitch(switches::kEnableExperimentalExtensionApis)); | 319 DCHECK(!command_line->HasSwitch(switches::kEnableExperimentalExtensionApis)); |
| 308 | 320 |
| 309 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); | 321 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); |
| 310 } | 322 } |
| OLD | NEW |