| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "content/public/browser/notification_observer.h" | 25 #include "content/public/browser/notification_observer.h" |
| 26 #include "content/public/browser/notification_registrar.h" | 26 #include "content/public/browser/notification_registrar.h" |
| 27 #include "content/public/test/browser_test_utils.h" | 27 #include "content/public/test/browser_test_utils.h" |
| 28 #include "extensions/browser/api/management/management_api.h" | 28 #include "extensions/browser/api/management/management_api.h" |
| 29 #include "extensions/browser/extension_dialog_auto_confirm.h" | 29 #include "extensions/browser/extension_dialog_auto_confirm.h" |
| 30 #include "extensions/browser/extension_system.h" | 30 #include "extensions/browser/extension_system.h" |
| 31 #include "extensions/browser/install/extension_install_ui.h" | 31 #include "extensions/browser/install/extension_install_ui.h" |
| 32 #include "gpu/config/gpu_feature_type.h" | 32 #include "gpu/config/gpu_feature_type.h" |
| 33 #include "gpu/config/gpu_info.h" | 33 #include "gpu/config/gpu_info.h" |
| 34 #include "net/dns/mock_host_resolver.h" | 34 #include "net/dns/mock_host_resolver.h" |
| 35 #include "ui/app_list/app_list_switches.h" | |
| 36 #include "ui/gl/gl_switches.h" | 35 #include "ui/gl/gl_switches.h" |
| 37 | 36 |
| 38 using gpu::GpuFeatureType; | 37 using gpu::GpuFeatureType; |
| 39 | 38 |
| 40 namespace utils = extension_function_test_utils; | 39 namespace utils = extension_function_test_utils; |
| 41 | 40 |
| 42 namespace extensions { | 41 namespace extensions { |
| 43 | 42 |
| 44 namespace { | 43 namespace { |
| 45 | 44 |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 gpu::GPUInfo gpu_info; | 390 gpu::GPUInfo gpu_info; |
| 392 content::GpuDataManager::GetInstance()->InitializeForTesting( | 391 content::GpuDataManager::GetInstance()->InitializeForTesting( |
| 393 json_blacklist, gpu_info); | 392 json_blacklist, gpu_info); |
| 394 EXPECT_TRUE(content::GpuDataManager::GetInstance()->IsFeatureBlacklisted( | 393 EXPECT_TRUE(content::GpuDataManager::GetInstance()->IsFeatureBlacklisted( |
| 395 gpu::GPU_FEATURE_TYPE_WEBGL)); | 394 gpu::GPU_FEATURE_TYPE_WEBGL)); |
| 396 | 395 |
| 397 bool webgl_allowed = false; | 396 bool webgl_allowed = false; |
| 398 RunTest(webgl_allowed); | 397 RunTest(webgl_allowed); |
| 399 } | 398 } |
| 400 | 399 |
| 401 class EphemeralAppWebstorePrivateApiTest | |
| 402 : public ExtensionWebstorePrivateApiTest { | |
| 403 public: | |
| 404 void SetUpInProcessBrowserTestFixture() override { | |
| 405 ExtensionWebstorePrivateApiTest::SetUpInProcessBrowserTestFixture(); | |
| 406 | |
| 407 net::HostPortPair host_port = test_server()->host_port_pair(); | |
| 408 std::string test_gallery_url = base::StringPrintf( | |
| 409 "http://www.example.com:%d/files/extensions/platform_apps/" | |
| 410 "ephemeral_launcher", | |
| 411 host_port.port()); | |
| 412 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( | |
| 413 switches::kAppsGalleryURL, test_gallery_url); | |
| 414 } | |
| 415 | |
| 416 GURL GetTestServerURL(const std::string& path) override { | |
| 417 return DoGetTestServerURL( | |
| 418 std::string("files/extensions/platform_apps/ephemeral_launcher/") + | |
| 419 path); | |
| 420 } | |
| 421 }; | |
| 422 | |
| 423 // Run tests when the --enable-ephemeral-apps switch is not enabled. | |
| 424 IN_PROC_BROWSER_TEST_F(EphemeralAppWebstorePrivateApiTest, | |
| 425 EphemeralAppsFeatureDisabled) { | |
| 426 base::CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 427 app_list::switches::kDisableExperimentalAppList); | |
| 428 ASSERT_TRUE(RunInstallTest("webstore_launch_disabled.html", "app.crx")); | |
| 429 } | |
| 430 | |
| 431 // Run tests when the --enable-ephemeral-apps switch is enabled. | |
| 432 IN_PROC_BROWSER_TEST_F(EphemeralAppWebstorePrivateApiTest, LaunchEphemeralApp) { | |
| 433 base::CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 434 switches::kEnableEphemeralAppsInWebstore); | |
| 435 base::CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 436 app_list::switches::kEnableExperimentalAppList); | |
| 437 ASSERT_TRUE(RunInstallTest("webstore_launch_app.html", "app.crx")); | |
| 438 } | |
| 439 | |
| 440 class BundleWebstorePrivateApiTest | 400 class BundleWebstorePrivateApiTest |
| 441 : public ExtensionWebstorePrivateApiTest { | 401 : public ExtensionWebstorePrivateApiTest { |
| 442 public: | 402 public: |
| 443 void SetUpInProcessBrowserTestFixture() override { | 403 void SetUpInProcessBrowserTestFixture() override { |
| 444 ExtensionWebstorePrivateApiTest::SetUpInProcessBrowserTestFixture(); | 404 ExtensionWebstorePrivateApiTest::SetUpInProcessBrowserTestFixture(); |
| 445 | 405 |
| 446 test_data_dir_ = test_data_dir_.AppendASCII("webstore_private/bundle"); | 406 test_data_dir_ = test_data_dir_.AppendASCII("webstore_private/bundle"); |
| 447 | 407 |
| 448 // The test server needs to have already started, so setup the switch here | 408 // The test server needs to have already started, so setup the switch here |
| 449 // rather than in SetUpCommandLine. | 409 // rather than in SetUpCommandLine. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 480 // CRX, 1 fails due to the manifests not matching, and 1 fails due to a missing | 440 // CRX, 1 fails due to the manifests not matching, and 1 fails due to a missing |
| 481 // crx file). | 441 // crx file). |
| 482 IN_PROC_BROWSER_TEST_F(BundleWebstorePrivateApiTest, InstallBundleInvalid) { | 442 IN_PROC_BROWSER_TEST_F(BundleWebstorePrivateApiTest, InstallBundleInvalid) { |
| 483 extensions::BundleInstaller::SetAutoApproveForTesting(true); | 443 extensions::BundleInstaller::SetAutoApproveForTesting(true); |
| 484 | 444 |
| 485 ASSERT_TRUE( | 445 ASSERT_TRUE( |
| 486 RunPageTest(GetTestServerURL("install_bundle_invalid.html").spec())); | 446 RunPageTest(GetTestServerURL("install_bundle_invalid.html").spec())); |
| 487 } | 447 } |
| 488 | 448 |
| 489 } // namespace extensions | 449 } // namespace extensions |
| OLD | NEW |