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

Side by Side Diff: chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc

Issue 10911158: Pass on download or installation errors from WebstoreInstaller to the CompleteInstall function. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase and rename error204->empty Created 8 years, 3 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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 } 285 }
286 286
287 // Now test the case where the user cancels the confirmation dialog. 287 // Now test the case where the user cancels the confirmation dialog.
288 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, InstallCancelled) { 288 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, InstallCancelled) {
289 CommandLine::ForCurrentProcess()->AppendSwitchASCII( 289 CommandLine::ForCurrentProcess()->AppendSwitchASCII(
290 switches::kAppsGalleryInstallAutoConfirmForTests, "cancel"); 290 switches::kAppsGalleryInstallAutoConfirmForTests, "cancel");
291 ASSERT_TRUE(RunInstallTest("cancelled.html", "extension.crx")); 291 ASSERT_TRUE(RunInstallTest("cancelled.html", "extension.crx"));
292 } 292 }
293 293
294 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, IncorrectManifest1) { 294 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, IncorrectManifest1) {
295 WebstoreInstallListener listener;
296 WebstorePrivateApi::SetWebstoreInstallerDelegateForTesting(&listener);
297 ASSERT_TRUE(RunInstallTest("incorrect_manifest1.html", "extension.crx")); 295 ASSERT_TRUE(RunInstallTest("incorrect_manifest1.html", "extension.crx"));
298 listener.Wait();
299 ASSERT_TRUE(listener.received_failure());
300 ASSERT_EQ("Manifest file is invalid.", listener.error());
301 } 296 }
302 297
303 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, IncorrectManifest2) { 298 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, IncorrectManifest2) {
304 WebstoreInstallListener listener;
305 WebstorePrivateApi::SetWebstoreInstallerDelegateForTesting(&listener);
306 ASSERT_TRUE(RunInstallTest("incorrect_manifest2.html", "extension.crx")); 299 ASSERT_TRUE(RunInstallTest("incorrect_manifest2.html", "extension.crx"));
307 listener.Wait();
308 EXPECT_TRUE(listener.received_failure());
309 ASSERT_EQ("Manifest file is invalid.", listener.error());
310 } 300 }
311 301
312 // Tests that we can request an app installed bubble (instead of the default 302 // Tests that we can request an app installed bubble (instead of the default
313 // UI when an app is installed). 303 // UI when an app is installed).
314 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, AppInstallBubble) { 304 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, AppInstallBubble) {
315 WebstoreInstallListener listener; 305 WebstoreInstallListener listener;
316 WebstorePrivateApi::SetWebstoreInstallerDelegateForTesting(&listener); 306 WebstorePrivateApi::SetWebstoreInstallerDelegateForTesting(&listener);
317 ASSERT_TRUE(RunInstallTest("app_install_bubble.html", "app.crx")); 307 ASSERT_TRUE(RunInstallTest("app_install_bubble.html", "app.crx"));
318 listener.Wait(); 308 listener.Wait();
319 ASSERT_TRUE(listener.received_success()); 309 ASSERT_TRUE(listener.received_success());
(...skipping 29 matching lines...) Expand all
349 // Tests that themes are installed without an install prompt. 339 // Tests that themes are installed without an install prompt.
350 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, InstallTheme) { 340 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, InstallTheme) {
351 WebstoreInstallListener listener; 341 WebstoreInstallListener listener;
352 WebstorePrivateApi::SetWebstoreInstallerDelegateForTesting(&listener); 342 WebstorePrivateApi::SetWebstoreInstallerDelegateForTesting(&listener);
353 ASSERT_TRUE(RunInstallTest("theme.html", "../../../theme.crx")); 343 ASSERT_TRUE(RunInstallTest("theme.html", "../../../theme.crx"));
354 listener.Wait(); 344 listener.Wait();
355 ASSERT_TRUE(listener.received_success()); 345 ASSERT_TRUE(listener.received_success());
356 ASSERT_EQ("iamefpfkojoapidjnbafmgkgncegbkad", listener.id()); 346 ASSERT_EQ("iamefpfkojoapidjnbafmgkgncegbkad", listener.id());
357 } 347 }
358 348
349 // Tests that an error is properly reported when an empty crx is returned.
350 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, EmptyCrx) {
351 ASSERT_TRUE(RunInstallTest("empty.html", "empty.crx"));
352 }
353
359 // Tests successfully installing a bundle of 2 apps and 2 extensions. 354 // Tests successfully installing a bundle of 2 apps and 2 extensions.
360 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateBundleTest, InstallBundle) { 355 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateBundleTest, InstallBundle) {
361 extensions::BundleInstaller::SetAutoApproveForTesting(true); 356 extensions::BundleInstaller::SetAutoApproveForTesting(true);
362 357
363 PackCRX("bmfoocgfinpmkmlbjhcbofejhkhlbchk", "extension1.json"); 358 PackCRX("bmfoocgfinpmkmlbjhcbofejhkhlbchk", "extension1.json");
364 PackCRX("pkapffpjmiilhlhbibjhamlmdhfneidj", "extension2.json"); 359 PackCRX("pkapffpjmiilhlhbibjhamlmdhfneidj", "extension2.json");
365 PackCRX("begfmnajjkbjdgmffnjaojchoncnmngg", "app1.json"); 360 PackCRX("begfmnajjkbjdgmffnjaojchoncnmngg", "app1.json");
366 PackCRX("mpneghmdnmaolkljkipbhaienajcflfe", "app2.json"); 361 PackCRX("mpneghmdnmaolkljkipbhaienajcflfe", "app2.json");
367 362
368 ASSERT_TRUE(RunPageTest(GetTestServerURL("install_bundle.html").spec())); 363 ASSERT_TRUE(RunPageTest(GetTestServerURL("install_bundle.html").spec()));
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 content::GpuDataManager::GetInstance()->Initialize("0", json_blacklist); 433 content::GpuDataManager::GetInstance()->Initialize("0", json_blacklist);
439 GpuFeatureType type = 434 GpuFeatureType type =
440 content::GpuDataManager::GetInstance()->GetBlacklistedFeatures(); 435 content::GpuDataManager::GetInstance()->GetBlacklistedFeatures();
441 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL); 436 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL);
442 437
443 bool webgl_allowed = false; 438 bool webgl_allowed = false;
444 RunTest(webgl_allowed); 439 RunTest(webgl_allowed);
445 } 440 }
446 441
447 } // namespace extensions 442 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698