Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Side by Side Diff: chrome/browser/extensions/extension_webstore_private_apitest.cc

Issue 10010038: Do not show the install prompt for themes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 bool received_failure_; 78 bool received_failure_;
79 bool received_success_; 79 bool received_success_;
80 bool waiting_; 80 bool waiting_;
81 std::string id_; 81 std::string id_;
82 std::string error_; 82 std::string error_;
83 }; 83 };
84 84
85 } // namespace 85 } // namespace
86 86
87 // A base class for tests below. 87 // A base class for tests below.
88 class ExtensionWebstorePrivateApiTest : public ExtensionApiTest { 88 class ExtensionNoConfirmWebstorePrivateApiTest : public ExtensionApiTest {
89 public: 89 public:
90 void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 90 void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
91 ExtensionApiTest::SetUpCommandLine(command_line); 91 ExtensionApiTest::SetUpCommandLine(command_line);
92 command_line->AppendSwitchASCII( 92 command_line->AppendSwitchASCII(
93 switches::kAppsGalleryURL, "http://www.example.com"); 93 switches::kAppsGalleryURL, "http://www.example.com");
94 command_line->AppendSwitchASCII(
95 switches::kAppsGalleryInstallAutoConfirmForTests, "accept");
96 } 94 }
97 95
98 void SetUpInProcessBrowserTestFixture() OVERRIDE { 96 void SetUpInProcessBrowserTestFixture() OVERRIDE {
99 // Start up the test server and get us ready for calling the install 97 // Start up the test server and get us ready for calling the install
100 // API functions. 98 // API functions.
101 host_resolver()->AddRule("www.example.com", "127.0.0.1"); 99 host_resolver()->AddRule("www.example.com", "127.0.0.1");
102 ASSERT_TRUE(test_server()->Start()); 100 ASSERT_TRUE(test_server()->Start());
103 ExtensionInstallUI::DisableFailureUIForTests(); 101 ExtensionInstallUI::DisableFailureUIForTests();
104 } 102 }
105 103
(...skipping 22 matching lines...) Expand all
128 126
129 GURL page_url = GetTestServerURL(page); 127 GURL page_url = GetTestServerURL(page);
130 return RunPageTest(page_url.spec()); 128 return RunPageTest(page_url.spec());
131 } 129 }
132 130
133 ExtensionService* service() { 131 ExtensionService* service() {
134 return browser()->profile()->GetExtensionService(); 132 return browser()->profile()->GetExtensionService();
135 } 133 }
136 }; 134 };
137 135
136 class ExtensionWebstorePrivateApiTest :
137 public ExtensionNoConfirmWebstorePrivateApiTest {
138 public:
139 void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
140 ExtensionNoConfirmWebstorePrivateApiTest::SetUpCommandLine(command_line);
141 command_line->AppendSwitchASCII(
142 switches::kAppsGalleryInstallAutoConfirmForTests, "accept");
143 }
144 };
145
138 class ExtensionWebstorePrivateBundleTest 146 class ExtensionWebstorePrivateBundleTest
139 : public ExtensionWebstorePrivateApiTest { 147 : public ExtensionWebstorePrivateApiTest {
140 public: 148 public:
141 void SetUpInProcessBrowserTestFixture() OVERRIDE { 149 void SetUpInProcessBrowserTestFixture() OVERRIDE {
142 ExtensionWebstorePrivateApiTest::SetUpInProcessBrowserTestFixture(); 150 ExtensionWebstorePrivateApiTest::SetUpInProcessBrowserTestFixture();
143 151
144 // The test server needs to have already started, so setup the switch here 152 // The test server needs to have already started, so setup the switch here
145 // rather than in SetUpCommandLine. 153 // rather than in SetUpCommandLine.
146 CommandLine::ForCurrentProcess()->AppendSwitchASCII( 154 CommandLine::ForCurrentProcess()->AppendSwitchASCII(
147 switches::kAppsGalleryDownloadURL, 155 switches::kAppsGalleryDownloadURL,
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 EXPECT_EQ(browser()->profile(), approval->profile); 330 EXPECT_EQ(browser()->profile(), approval->profile);
323 331
324 approval = WebstorePrivateApi::PopApprovalForTesting( 332 approval = WebstorePrivateApi::PopApprovalForTesting(
325 browser()->profile(), extensionId); 333 browser()->profile(), extensionId);
326 EXPECT_EQ(extensionId, approval->extension_id); 334 EXPECT_EQ(extensionId, approval->extension_id);
327 EXPECT_FALSE(approval->use_app_installed_bubble); 335 EXPECT_FALSE(approval->use_app_installed_bubble);
328 EXPECT_FALSE(approval->skip_post_install_ui); 336 EXPECT_FALSE(approval->skip_post_install_ui);
329 EXPECT_EQ(browser()->profile(), approval->profile); 337 EXPECT_EQ(browser()->profile(), approval->profile);
330 } 338 }
331 339
340 // Tests that themes are installed without an install prompt.
341 IN_PROC_BROWSER_TEST_F(ExtensionNoConfirmWebstorePrivateApiTest,
342 InstallTheme) {
343 WebstoreInstallListener listener;
344 WebstorePrivateApi::SetWebstoreInstallerDelegateForTesting(&listener);
345 ASSERT_TRUE(RunInstallTest("theme.html", "../../theme.crx"));
346 listener.Wait();
347 ASSERT_TRUE(listener.received_success());
348 ASSERT_EQ("iamefpfkojoapidjnbafmgkgncegbkad", listener.id());
349 }
350
332 // Tests using silentlyInstall to install extensions. 351 // Tests using silentlyInstall to install extensions.
333 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateBundleTest, SilentlyInstall) { 352 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateBundleTest, SilentlyInstall) {
334 WebstorePrivateApi::SetTrustTestIDsForTesting(true); 353 WebstorePrivateApi::SetTrustTestIDsForTesting(true);
335 354
336 PackCRX("bmfoocgfinpmkmlbjhcbofejhkhlbchk", "extension1.json"); 355 PackCRX("bmfoocgfinpmkmlbjhcbofejhkhlbchk", "extension1.json");
337 PackCRX("mpneghmdnmaolkljkipbhaienajcflfe", "extension2.json"); 356 PackCRX("mpneghmdnmaolkljkipbhaienajcflfe", "extension2.json");
338 PackCRX("begfmnajjkbjdgmffnjaojchoncnmngg", "app2.json"); 357 PackCRX("begfmnajjkbjdgmffnjaojchoncnmngg", "app2.json");
339 358
340 ASSERT_TRUE(RunPageTest(GetTestServerURL("silently_install.html").spec())); 359 ASSERT_TRUE(RunPageTest(GetTestServerURL("silently_install.html").spec()));
341 } 360 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 ASSERT_TRUE(blacklist->LoadGpuBlacklist( 444 ASSERT_TRUE(blacklist->LoadGpuBlacklist(
426 json_blacklist, GpuBlacklist::kAllOs)); 445 json_blacklist, GpuBlacklist::kAllOs));
427 blacklist->UpdateGpuDataManager(); 446 blacklist->UpdateGpuDataManager();
428 GpuFeatureType type = 447 GpuFeatureType type =
429 content::GpuDataManager::GetInstance()->GetGpuFeatureType(); 448 content::GpuDataManager::GetInstance()->GetGpuFeatureType();
430 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL); 449 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL);
431 450
432 bool webgl_allowed = false; 451 bool webgl_allowed = false;
433 RunTest(webgl_allowed); 452 RunTest(webgl_allowed);
434 } 453 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698