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/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "chrome/browser/extensions/bundle_installer.h" | 10 #include "chrome/browser/extensions/bundle_installer.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 bool received_failure_; | 80 bool received_failure_; |
81 bool received_success_; | 81 bool received_success_; |
82 bool waiting_; | 82 bool waiting_; |
83 std::string id_; | 83 std::string id_; |
84 std::string error_; | 84 std::string error_; |
85 }; | 85 }; |
86 | 86 |
87 } // namespace | 87 } // namespace |
88 | 88 |
89 // A base class for tests below. | 89 // A base class for tests below. |
90 class ExtensionNoConfirmWebstorePrivateApiTest : public ExtensionApiTest { | 90 class ExtensionWebstorePrivateApiTest : public ExtensionApiTest { |
91 public: | 91 public: |
92 void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 92 void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
93 ExtensionApiTest::SetUpCommandLine(command_line); | 93 ExtensionApiTest::SetUpCommandLine(command_line); |
94 command_line->AppendSwitchASCII( | 94 command_line->AppendSwitchASCII( |
95 switches::kAppsGalleryURL, "http://www.example.com"); | 95 switches::kAppsGalleryURL, "http://www.example.com"); |
| 96 command_line->AppendSwitchASCII( |
| 97 switches::kAppsGalleryInstallAutoConfirmForTests, "accept"); |
96 } | 98 } |
97 | 99 |
98 void SetUpInProcessBrowserTestFixture() OVERRIDE { | 100 void SetUpInProcessBrowserTestFixture() OVERRIDE { |
99 // Start up the test server and get us ready for calling the install | 101 // Start up the test server and get us ready for calling the install |
100 // API functions. | 102 // API functions. |
101 host_resolver()->AddRule("www.example.com", "127.0.0.1"); | 103 host_resolver()->AddRule("www.example.com", "127.0.0.1"); |
102 ASSERT_TRUE(test_server()->Start()); | 104 ASSERT_TRUE(test_server()->Start()); |
103 ExtensionInstallUI::DisableFailureUIForTests(); | 105 ExtensionInstallUI::DisableFailureUIForTests(); |
104 | 106 |
105 ASSERT_TRUE(tmp_.CreateUniqueTempDirUnderPath(test_data_dir_)); | 107 ASSERT_TRUE(tmp_.CreateUniqueTempDirUnderPath(test_data_dir_)); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 return RunPageTest(page_url.spec()); | 143 return RunPageTest(page_url.spec()); |
142 } | 144 } |
143 | 145 |
144 ExtensionService* service() { | 146 ExtensionService* service() { |
145 return browser()->profile()->GetExtensionService(); | 147 return browser()->profile()->GetExtensionService(); |
146 } | 148 } |
147 | 149 |
148 ScopedTempDir tmp_; | 150 ScopedTempDir tmp_; |
149 }; | 151 }; |
150 | 152 |
151 class ExtensionWebstorePrivateApiTest : | |
152 public ExtensionNoConfirmWebstorePrivateApiTest { | |
153 public: | |
154 void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | |
155 ExtensionNoConfirmWebstorePrivateApiTest::SetUpCommandLine(command_line); | |
156 command_line->AppendSwitchASCII( | |
157 switches::kAppsGalleryInstallAutoConfirmForTests, "accept"); | |
158 } | |
159 }; | |
160 | |
161 class ExtensionWebstorePrivateBundleTest | 153 class ExtensionWebstorePrivateBundleTest |
162 : public ExtensionWebstorePrivateApiTest { | 154 : public ExtensionWebstorePrivateApiTest { |
163 public: | 155 public: |
164 void SetUpInProcessBrowserTestFixture() OVERRIDE { | 156 void SetUpInProcessBrowserTestFixture() OVERRIDE { |
165 ExtensionWebstorePrivateApiTest::SetUpInProcessBrowserTestFixture(); | 157 ExtensionWebstorePrivateApiTest::SetUpInProcessBrowserTestFixture(); |
166 | 158 |
167 // The test server needs to have already started, so setup the switch here | 159 // The test server needs to have already started, so setup the switch here |
168 // rather than in SetUpCommandLine. | 160 // rather than in SetUpCommandLine. |
169 CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 161 CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
170 switches::kAppsGalleryDownloadURL, | 162 switches::kAppsGalleryDownloadURL, |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 | 338 |
347 approval = WebstorePrivateApi::PopApprovalForTesting( | 339 approval = WebstorePrivateApi::PopApprovalForTesting( |
348 browser()->profile(), extensionId); | 340 browser()->profile(), extensionId); |
349 EXPECT_EQ(extensionId, approval->extension_id); | 341 EXPECT_EQ(extensionId, approval->extension_id); |
350 EXPECT_FALSE(approval->use_app_installed_bubble); | 342 EXPECT_FALSE(approval->use_app_installed_bubble); |
351 EXPECT_FALSE(approval->skip_post_install_ui); | 343 EXPECT_FALSE(approval->skip_post_install_ui); |
352 EXPECT_EQ(browser()->profile(), approval->profile); | 344 EXPECT_EQ(browser()->profile(), approval->profile); |
353 } | 345 } |
354 | 346 |
355 // Tests that themes are installed without an install prompt. | 347 // Tests that themes are installed without an install prompt. |
356 IN_PROC_BROWSER_TEST_F(ExtensionNoConfirmWebstorePrivateApiTest, | 348 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, InstallTheme) { |
357 InstallTheme) { | |
358 WebstoreInstallListener listener; | 349 WebstoreInstallListener listener; |
359 WebstorePrivateApi::SetWebstoreInstallerDelegateForTesting(&listener); | 350 WebstorePrivateApi::SetWebstoreInstallerDelegateForTesting(&listener); |
360 ASSERT_TRUE(RunInstallTest("theme.html", "../../../theme.crx")); | 351 ASSERT_TRUE(RunInstallTest("theme.html", "../../../theme.crx")); |
361 listener.Wait(); | 352 listener.Wait(); |
362 ASSERT_TRUE(listener.received_success()); | 353 ASSERT_TRUE(listener.received_success()); |
363 ASSERT_EQ("iamefpfkojoapidjnbafmgkgncegbkad", listener.id()); | 354 ASSERT_EQ("iamefpfkojoapidjnbafmgkgncegbkad", listener.id()); |
364 } | 355 } |
365 | 356 |
366 // Tests using silentlyInstall to install extensions. | 357 // Tests using silentlyInstall to install extensions. |
367 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateBundleTest, SilentlyInstall) { | 358 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateBundleTest, SilentlyInstall) { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 blacklist->UpdateGpuDataManager(); | 452 blacklist->UpdateGpuDataManager(); |
462 GpuFeatureType type = | 453 GpuFeatureType type = |
463 content::GpuDataManager::GetInstance()->GetGpuFeatureType(); | 454 content::GpuDataManager::GetInstance()->GetGpuFeatureType(); |
464 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL); | 455 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL); |
465 | 456 |
466 bool webgl_allowed = false; | 457 bool webgl_allowed = false; |
467 RunTest(webgl_allowed); | 458 RunTest(webgl_allowed); |
468 } | 459 } |
469 | 460 |
470 } // namespace extensions | 461 } // namespace extensions |
OLD | NEW |