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

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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 128
129 GURL page_url = GetTestServerURL(page); 129 GURL page_url = GetTestServerURL(page);
130 return RunPageTest(page_url.spec()); 130 return RunPageTest(page_url.spec());
131 } 131 }
132 132
133 ExtensionService* service() { 133 ExtensionService* service() {
134 return browser()->profile()->GetExtensionService(); 134 return browser()->profile()->GetExtensionService();
135 } 135 }
136 }; 136 };
137 137
138 // The same as ExtensionWebstorePrivateApiTest except it uses the default
139 // install prompt behavior.
140 class ExtensionNoConfirmWebstorePrivateApiTest
141 : public ExtensionWebstorePrivateApiTest {
142 public:
143 void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
144 // We set this switch here to supercede the value set in
145 // ExtensionWebstorePrivateApiTest (you can't easily remove switches).
Yoyo Zhou 2012/04/20 15:38:14 Could you make the inheritance go the other way so
jstritar 2012/04/20 16:18:27 Done.
146 command_line->AppendSwitchASCII(
147 switches::kAppsGalleryInstallAutoConfirmForTests, "default");
148
149 ExtensionWebstorePrivateApiTest::SetUpCommandLine(command_line);
150 }
151 };
152
138 class ExtensionWebstorePrivateBundleTest 153 class ExtensionWebstorePrivateBundleTest
139 : public ExtensionWebstorePrivateApiTest { 154 : public ExtensionWebstorePrivateApiTest {
140 public: 155 public:
141 void SetUpInProcessBrowserTestFixture() OVERRIDE { 156 void SetUpInProcessBrowserTestFixture() OVERRIDE {
142 ExtensionWebstorePrivateApiTest::SetUpInProcessBrowserTestFixture(); 157 ExtensionWebstorePrivateApiTest::SetUpInProcessBrowserTestFixture();
143 158
144 // 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
145 // rather than in SetUpCommandLine. 160 // rather than in SetUpCommandLine.
146 CommandLine::ForCurrentProcess()->AppendSwitchASCII( 161 CommandLine::ForCurrentProcess()->AppendSwitchASCII(
147 switches::kAppsGalleryDownloadURL, 162 switches::kAppsGalleryDownloadURL,
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 EXPECT_EQ(browser()->profile(), approval->profile); 337 EXPECT_EQ(browser()->profile(), approval->profile);
323 338
324 approval = WebstorePrivateApi::PopApprovalForTesting( 339 approval = WebstorePrivateApi::PopApprovalForTesting(
325 browser()->profile(), extensionId); 340 browser()->profile(), extensionId);
326 EXPECT_EQ(extensionId, approval->extension_id); 341 EXPECT_EQ(extensionId, approval->extension_id);
327 EXPECT_FALSE(approval->use_app_installed_bubble); 342 EXPECT_FALSE(approval->use_app_installed_bubble);
328 EXPECT_FALSE(approval->skip_post_install_ui); 343 EXPECT_FALSE(approval->skip_post_install_ui);
329 EXPECT_EQ(browser()->profile(), approval->profile); 344 EXPECT_EQ(browser()->profile(), approval->profile);
330 } 345 }
331 346
347 // Tests that themes are installed without an install prompt.
348 IN_PROC_BROWSER_TEST_F(ExtensionNoConfirmWebstorePrivateApiTest, InstallTheme) {
349 WebstoreInstallListener listener;
350 WebstorePrivateApi::SetWebstoreInstallerDelegateForTesting(&listener);
351 ASSERT_TRUE(RunInstallTest("theme.html", "../../theme.crx"));
352 listener.Wait();
353 ASSERT_TRUE(listener.received_success());
354 ASSERT_EQ("iamefpfkojoapidjnbafmgkgncegbkad", listener.id());
355 }
356
332 // Tests using silentlyInstall to install extensions. 357 // Tests using silentlyInstall to install extensions.
333 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateBundleTest, SilentlyInstall) { 358 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateBundleTest, SilentlyInstall) {
334 WebstorePrivateApi::SetTrustTestIDsForTesting(true); 359 WebstorePrivateApi::SetTrustTestIDsForTesting(true);
335 360
336 PackCRX("bmfoocgfinpmkmlbjhcbofejhkhlbchk", "extension1.json"); 361 PackCRX("bmfoocgfinpmkmlbjhcbofejhkhlbchk", "extension1.json");
337 PackCRX("mpneghmdnmaolkljkipbhaienajcflfe", "extension2.json"); 362 PackCRX("mpneghmdnmaolkljkipbhaienajcflfe", "extension2.json");
338 PackCRX("begfmnajjkbjdgmffnjaojchoncnmngg", "app2.json"); 363 PackCRX("begfmnajjkbjdgmffnjaojchoncnmngg", "app2.json");
339 364
340 ASSERT_TRUE(RunPageTest(GetTestServerURL("silently_install.html").spec())); 365 ASSERT_TRUE(RunPageTest(GetTestServerURL("silently_install.html").spec()));
341 } 366 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 ASSERT_TRUE(blacklist->LoadGpuBlacklist( 450 ASSERT_TRUE(blacklist->LoadGpuBlacklist(
426 json_blacklist, GpuBlacklist::kAllOs)); 451 json_blacklist, GpuBlacklist::kAllOs));
427 blacklist->UpdateGpuDataManager(); 452 blacklist->UpdateGpuDataManager();
428 GpuFeatureType type = 453 GpuFeatureType type =
429 content::GpuDataManager::GetInstance()->GetGpuFeatureType(); 454 content::GpuDataManager::GetInstance()->GetGpuFeatureType();
430 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL); 455 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL);
431 456
432 bool webgl_allowed = false; 457 bool webgl_allowed = false;
433 RunTest(webgl_allowed); 458 RunTest(webgl_allowed);
434 } 459 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698