| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/base_switches.h" | 10 #include "base/base_switches.h" |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 fourth_extension_path.AppendASCII("extensions").AppendASCII("app2"); | 300 fourth_extension_path.AppendASCII("extensions").AppendASCII("app2"); |
| 301 load_extensions_.push_back(fourth_extension_path.value()); | 301 load_extensions_.push_back(fourth_extension_path.value()); |
| 302 } | 302 } |
| 303 }; | 303 }; |
| 304 | 304 |
| 305 IN_PROC_BROWSER_TEST_F(ExtensionsLoadMultipleTest, Test) { | 305 IN_PROC_BROWSER_TEST_F(ExtensionsLoadMultipleTest, Test) { |
| 306 WaitForServicesToStart(4, true); | 306 WaitForServicesToStart(4, true); |
| 307 TestInjection(true, true); | 307 TestInjection(true, true); |
| 308 } | 308 } |
| 309 | 309 |
| 310 // TODO(catmullings): Remove test in future chrome release, perhaps M59. |
| 311 class DeprecatedLoadComponentExtensionSwitchBrowserTest |
| 312 : public ExtensionBrowserTest { |
| 313 public: |
| 314 DeprecatedLoadComponentExtensionSwitchBrowserTest() {} |
| 315 |
| 316 void SetUpCommandLine(base::CommandLine* command_line) override; |
| 317 |
| 318 ExtensionRegistry* GetExtensionRegistry() { |
| 319 return ExtensionRegistry::Get(browser()->profile()); |
| 320 } |
| 321 }; |
| 322 |
| 323 void DeprecatedLoadComponentExtensionSwitchBrowserTest::SetUpCommandLine( |
| 324 base::CommandLine* command_line) { |
| 325 ExtensionBrowserTest::SetUpCommandLine(command_line); |
| 326 base::FilePath fp1(test_data_dir_.AppendASCII("app_dot_com_app/")); |
| 327 base::FilePath fp2(test_data_dir_.AppendASCII("app/")); |
| 328 |
| 329 command_line->AppendSwitchASCII( |
| 330 "load-component-extension", |
| 331 fp1.AsUTF8Unsafe() + "," + fp2.AsUTF8Unsafe()); |
| 332 } |
| 333 |
| 334 // Tests that the --load-component-extension flag is not supported. |
| 335 IN_PROC_BROWSER_TEST_F(DeprecatedLoadComponentExtensionSwitchBrowserTest, |
| 336 DefunctLoadComponentExtensionFlag) { |
| 337 EXPECT_TRUE(extension_service()->extensions_enabled()); |
| 338 |
| 339 // Checks that the extensions loaded with the --load-component-extension flag |
| 340 // are not installed. |
| 341 bool is_app_dot_com_extension_installed = false; |
| 342 bool is_app_test_extension_installed = false; |
| 343 for (const scoped_refptr<const extensions::Extension>& extension : |
| 344 GetExtensionRegistry()->enabled_extensions()) { |
| 345 if (extension->name() == "App Dot Com: The App") { |
| 346 is_app_dot_com_extension_installed = true; |
| 347 } else if (extension->name() == "App Test") { |
| 348 is_app_test_extension_installed = true; |
| 349 } else { |
| 350 EXPECT_TRUE( |
| 351 extensions::Manifest::IsComponentLocation(extension->location())); |
| 352 } |
| 353 } |
| 354 EXPECT_FALSE(is_app_dot_com_extension_installed); |
| 355 EXPECT_FALSE(is_app_test_extension_installed); |
| 356 } |
| 357 |
| 310 class DisableExtensionsExceptBrowserTest : public ExtensionBrowserTest { | 358 class DisableExtensionsExceptBrowserTest : public ExtensionBrowserTest { |
| 311 public: | 359 public: |
| 312 DisableExtensionsExceptBrowserTest() {} | 360 DisableExtensionsExceptBrowserTest() {} |
| 313 | 361 |
| 314 void SetUpCommandLine(base::CommandLine* command_line) override; | 362 void SetUpCommandLine(base::CommandLine* command_line) override; |
| 315 | 363 |
| 316 ExtensionRegistry* GetExtensionRegistry() { | 364 ExtensionRegistry* GetExtensionRegistry() { |
| 317 return ExtensionRegistry::Get(browser()->profile()); | 365 return ExtensionRegistry::Get(browser()->profile()); |
| 318 } | 366 } |
| 319 }; | 367 }; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 348 } else if (extension->name() == "App Test") { | 396 } else if (extension->name() == "App Test") { |
| 349 is_app_test_extension_enabled = true; | 397 is_app_test_extension_enabled = true; |
| 350 } else { | 398 } else { |
| 351 EXPECT_TRUE( | 399 EXPECT_TRUE( |
| 352 extensions::Manifest::IsComponentLocation(extension->location())); | 400 extensions::Manifest::IsComponentLocation(extension->location())); |
| 353 } | 401 } |
| 354 } | 402 } |
| 355 EXPECT_TRUE(is_app_dot_com_extension_enabled); | 403 EXPECT_TRUE(is_app_dot_com_extension_enabled); |
| 356 EXPECT_TRUE(is_app_test_extension_enabled); | 404 EXPECT_TRUE(is_app_test_extension_enabled); |
| 357 } | 405 } |
| OLD | NEW |