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

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

Issue 7741037: Add WebstoreInlineInstaller (downloads store data, shows the install UI, and starts the install). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Put webstore response in the right directory. Created 9 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/stringprintf.h" 5 #include "base/stringprintf.h"
6 #include "chrome/browser/extensions/extension_apitest.h" 6 #include "chrome/browser/extensions/extension_apitest.h"
7 #include "chrome/browser/extensions/extension_install_dialog.h"
7 #include "chrome/browser/extensions/extension_install_ui.h" 8 #include "chrome/browser/extensions/extension_install_ui.h"
8 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/extensions/extension_webstore_private_api.h" 10 #include "chrome/browser/extensions/extension_webstore_private_api.h"
10 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
12 #include "chrome/common/chrome_notification_types.h" 13 #include "chrome/common/chrome_notification_types.h"
13 #include "chrome/common/chrome_switches.h" 14 #include "chrome/common/chrome_switches.h"
14 #include "chrome/test/base/ui_test_utils.h" 15 #include "chrome/test/base/ui_test_utils.h"
15 #include "content/common/notification_observer.h" 16 #include "content/common/notification_observer.h"
16 #include "content/common/notification_registrar.h" 17 #include "content/common/notification_registrar.h"
17 #include "content/common/notification_service.h" 18 #include "content/common/notification_service.h"
18 #include "net/base/mock_host_resolver.h" 19 #include "net/base/mock_host_resolver.h"
19 20
20 // A base class for tests below. 21 // A base class for tests below.
21 class ExtensionWebstorePrivateApiTest : public ExtensionApiTest { 22 class ExtensionWebstorePrivateApiTest : public ExtensionApiTest {
22 public: 23 public:
23 void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 24 void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
24 ExtensionApiTest::SetUpCommandLine(command_line); 25 ExtensionApiTest::SetUpCommandLine(command_line);
25 command_line->AppendSwitchASCII(switches::kAppsGalleryURL, 26 command_line->AppendSwitchASCII(switches::kAppsGalleryURL,
26 "http://www.example.com"); 27 "http://www.example.com");
27 } 28 }
28 29
29 void SetUpInProcessBrowserTestFixture() OVERRIDE { 30 void SetUpInProcessBrowserTestFixture() OVERRIDE {
30 // Start up the test server and get us ready for calling the install 31 // Start up the test server and get us ready for calling the install
31 // API functions. 32 // API functions.
32 host_resolver()->AddRule("www.example.com", "127.0.0.1"); 33 host_resolver()->AddRule("www.example.com", "127.0.0.1");
33 ASSERT_TRUE(test_server()->Start()); 34 ASSERT_TRUE(test_server()->Start());
34 BeginInstallWithManifestFunction::SetIgnoreUserGestureForTests(true); 35 BeginInstallWithManifestFunction::SetIgnoreUserGestureForTests(true);
35 BeginInstallWithManifestFunction::SetAutoConfirmForTests(true); 36 SetExtensionInstallDialogForManifestAutoConfirmForTests(true);
36 ExtensionInstallUI::DisableFailureUIForTests(); 37 ExtensionInstallUI::DisableFailureUIForTests();
37 } 38 }
38 39
39 protected: 40 protected:
40 // Returns a test server URL, but with host 'www.example.com' so it matches 41 // Returns a test server URL, but with host 'www.example.com' so it matches
41 // the web store app's extent that we set up via command line flags. 42 // the web store app's extent that we set up via command line flags.
42 GURL GetTestServerURL(const std::string& path) { 43 GURL GetTestServerURL(const std::string& path) {
43 GURL url = test_server()->GetURL( 44 GURL url = test_server()->GetURL(
44 std::string("files/extensions/api_test/webstore_private/") + path); 45 std::string("files/extensions/api_test/webstore_private/") + path);
45 46
(...skipping 27 matching lines...) Expand all
73 ASSERT_TRUE(RunInstallTest("accepted.html", "extension.crx")); 74 ASSERT_TRUE(RunInstallTest("accepted.html", "extension.crx"));
74 } 75 }
75 76
76 // Tests passing a localized name. 77 // Tests passing a localized name.
77 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, InstallLocalized) { 78 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, InstallLocalized) {
78 ASSERT_TRUE(RunInstallTest("localized.html", "localized_extension.crx")); 79 ASSERT_TRUE(RunInstallTest("localized.html", "localized_extension.crx"));
79 } 80 }
80 81
81 // Now test the case where the user cancels the confirmation dialog. 82 // Now test the case where the user cancels the confirmation dialog.
82 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, InstallCancelled) { 83 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, InstallCancelled) {
83 BeginInstallWithManifestFunction::SetAutoConfirmForTests(false); 84 SetExtensionInstallDialogForManifestAutoConfirmForTests(false);
84 ASSERT_TRUE(RunInstallTest("cancelled.html", "extension.crx")); 85 ASSERT_TRUE(RunInstallTest("cancelled.html", "extension.crx"));
85 } 86 }
86 87
87 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, InstallNoGesture) { 88 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, InstallNoGesture) {
88 BeginInstallFunction::SetIgnoreUserGestureForTests(false); 89 BeginInstallFunction::SetIgnoreUserGestureForTests(false);
89 ASSERT_TRUE(RunInstallTest("no_user_gesture.html", "extension.crx")); 90 ASSERT_TRUE(RunInstallTest("no_user_gesture.html", "extension.crx"));
90 } 91 }
91 92
92 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, 93 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest,
93 IncorrectManifest1) { 94 IncorrectManifest1) {
(...skipping 18 matching lines...) Expand all
112 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, 113 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest,
113 AppInstallBubble) { 114 AppInstallBubble) {
114 ASSERT_TRUE(RunInstallTest("app_install_bubble.html", "app.crx")); 115 ASSERT_TRUE(RunInstallTest("app_install_bubble.html", "app.crx"));
115 } 116 }
116 117
117 // Tests using the iconUrl parameter to the install function. 118 // Tests using the iconUrl parameter to the install function.
118 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, 119 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest,
119 IconUrl) { 120 IconUrl) {
120 ASSERT_TRUE(RunInstallTest("icon_url.html", "extension.crx")); 121 ASSERT_TRUE(RunInstallTest("icon_url.html", "extension.crx"));
121 } 122 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698