OLD | NEW |
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 <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/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 ExtensionApiTest::SetUpCommandLine(command_line); | 86 ExtensionApiTest::SetUpCommandLine(command_line); |
87 command_line->AppendSwitchASCII(switches::kAppsGalleryURL, | 87 command_line->AppendSwitchASCII(switches::kAppsGalleryURL, |
88 "http://www.example.com"); | 88 "http://www.example.com"); |
89 } | 89 } |
90 | 90 |
91 void SetUpInProcessBrowserTestFixture() OVERRIDE { | 91 void SetUpInProcessBrowserTestFixture() OVERRIDE { |
92 // Start up the test server and get us ready for calling the install | 92 // Start up the test server and get us ready for calling the install |
93 // API functions. | 93 // API functions. |
94 host_resolver()->AddRule("www.example.com", "127.0.0.1"); | 94 host_resolver()->AddRule("www.example.com", "127.0.0.1"); |
95 ASSERT_TRUE(test_server()->Start()); | 95 ASSERT_TRUE(test_server()->Start()); |
96 SetExtensionInstallDialogForManifestAutoConfirmForTests(true); | 96 SetExtensionInstallDialogAutoConfirmForTests(true); |
97 ExtensionInstallUI::DisableFailureUIForTests(); | 97 ExtensionInstallUI::DisableFailureUIForTests(); |
98 } | 98 } |
99 | 99 |
100 protected: | 100 protected: |
101 // Returns a test server URL, but with host 'www.example.com' so it matches | 101 // Returns a test server URL, but with host 'www.example.com' so it matches |
102 // the web store app's extent that we set up via command line flags. | 102 // the web store app's extent that we set up via command line flags. |
103 GURL GetTestServerURL(const std::string& path) { | 103 GURL GetTestServerURL(const std::string& path) { |
104 GURL url = test_server()->GetURL( | 104 GURL url = test_server()->GetURL( |
105 std::string("files/extensions/api_test/webstore_private/") + path); | 105 std::string("files/extensions/api_test/webstore_private/") + path); |
106 | 106 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 ASSERT_TRUE(RunInstallTest("accepted.html", "extension.crx")); | 175 ASSERT_TRUE(RunInstallTest("accepted.html", "extension.crx")); |
176 } | 176 } |
177 | 177 |
178 // Tests passing a localized name. | 178 // Tests passing a localized name. |
179 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, InstallLocalized) { | 179 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, InstallLocalized) { |
180 ASSERT_TRUE(RunInstallTest("localized.html", "localized_extension.crx")); | 180 ASSERT_TRUE(RunInstallTest("localized.html", "localized_extension.crx")); |
181 } | 181 } |
182 | 182 |
183 // Now test the case where the user cancels the confirmation dialog. | 183 // Now test the case where the user cancels the confirmation dialog. |
184 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, InstallCancelled) { | 184 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, InstallCancelled) { |
185 SetExtensionInstallDialogForManifestAutoConfirmForTests(false); | 185 SetExtensionInstallDialogAutoConfirmForTests(false); |
186 ASSERT_TRUE(RunInstallTest("cancelled.html", "extension.crx")); | 186 ASSERT_TRUE(RunInstallTest("cancelled.html", "extension.crx")); |
187 } | 187 } |
188 | 188 |
189 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, | 189 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, |
190 IncorrectManifest1) { | 190 IncorrectManifest1) { |
191 WebstoreInstallListener listener; | 191 WebstoreInstallListener listener; |
192 WebstorePrivateApi::SetWebstoreInstallerDelegateForTesting(&listener); | 192 WebstorePrivateApi::SetWebstoreInstallerDelegateForTesting(&listener); |
193 ASSERT_TRUE(RunInstallTest("incorrect_manifest1.html", "extension.crx")); | 193 ASSERT_TRUE(RunInstallTest("incorrect_manifest1.html", "extension.crx")); |
194 listener.Wait(); | 194 listener.Wait(); |
195 ASSERT_TRUE(listener.received_failure()); | 195 ASSERT_TRUE(listener.received_failure()); |
(...skipping 26 matching lines...) Expand all Loading... |
222 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, | 222 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, |
223 IconUrl) { | 223 IconUrl) { |
224 ASSERT_TRUE(RunInstallTest("icon_url.html", "extension.crx")); | 224 ASSERT_TRUE(RunInstallTest("icon_url.html", "extension.crx")); |
225 } | 225 } |
226 | 226 |
227 // Tests using silentlyInstall to install extensions. | 227 // Tests using silentlyInstall to install extensions. |
228 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateBundleTest, SilentlyInstall) { | 228 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateBundleTest, SilentlyInstall) { |
229 WebstorePrivateApi::SetTrustTestIDsForTesting(true); | 229 WebstorePrivateApi::SetTrustTestIDsForTesting(true); |
230 ASSERT_TRUE(RunPageTest(GetTestServerURL("silently_install.html").spec())); | 230 ASSERT_TRUE(RunPageTest(GetTestServerURL("silently_install.html").spec())); |
231 } | 231 } |
OLD | NEW |