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

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

Issue 65163003: Move GetWebstoreLaunchURL and GetWebstoreItemDetailURLPrefix to extensions/common/extension_urls.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mt Created 7 years, 1 month 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_util.h" 7 #include "base/file_util.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "chrome/browser/chrome_notification_types.h" 11 #include "chrome/browser/chrome_notification_types.h"
12 #include "chrome/browser/extensions/api/webstore_private/webstore_private_api.h" 12 #include "chrome/browser/extensions/api/webstore_private/webstore_private_api.h"
13 #include "chrome/browser/extensions/extension_apitest.h" 13 #include "chrome/browser/extensions/extension_apitest.h"
14 #include "chrome/browser/extensions/extension_function_test_utils.h" 14 #include "chrome/browser/extensions/extension_function_test_utils.h"
15 #include "chrome/browser/extensions/extension_install_prompt.h" 15 #include "chrome/browser/extensions/extension_install_prompt.h"
16 #include "chrome/browser/extensions/extension_install_ui.h" 16 #include "chrome/browser/extensions/extension_install_ui.h"
17 #include "chrome/browser/extensions/extension_service.h" 17 #include "chrome/browser/extensions/extension_service.h"
18 #include "chrome/browser/extensions/webstore_installer.h" 18 #include "chrome/browser/extensions/webstore_installer.h"
19 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/ui/browser.h" 20 #include "chrome/browser/ui/browser.h"
21 #include "chrome/browser/ui/tabs/tab_strip_model.h" 21 #include "chrome/browser/ui/tabs/tab_strip_model.h"
22 #include "chrome/common/chrome_switches.h" 22 #include "chrome/common/chrome_switches.h"
23 #include "chrome/test/base/ui_test_utils.h" 23 #include "chrome/test/base/ui_test_utils.h"
24 #include "content/public/browser/gpu_data_manager.h" 24 #include "content/public/browser/gpu_data_manager.h"
25 #include "content/public/browser/notification_observer.h" 25 #include "content/public/browser/notification_observer.h"
26 #include "content/public/browser/notification_registrar.h" 26 #include "content/public/browser/notification_registrar.h"
27 #include "content/public/test/browser_test_utils.h" 27 #include "content/public/test/browser_test_utils.h"
28 #include "extensions/common/switches.h"
28 #include "gpu/config/gpu_feature_type.h" 29 #include "gpu/config/gpu_feature_type.h"
29 #include "gpu/config/gpu_info.h" 30 #include "gpu/config/gpu_info.h"
30 #include "net/dns/mock_host_resolver.h" 31 #include "net/dns/mock_host_resolver.h"
31 #include "ui/gl/gl_switches.h" 32 #include "ui/gl/gl_switches.h"
32 33
33 using gpu::GpuFeatureType; 34 using gpu::GpuFeatureType;
34 35
35 namespace utils = extension_function_test_utils; 36 namespace utils = extension_function_test_utils;
36 37
37 namespace extensions { 38 namespace extensions {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 90
90 // A base class for tests below. 91 // A base class for tests below.
91 class ExtensionWebstorePrivateApiTest : public ExtensionApiTest { 92 class ExtensionWebstorePrivateApiTest : public ExtensionApiTest {
92 public: 93 public:
93 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 94 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
94 ExtensionApiTest::SetUpCommandLine(command_line); 95 ExtensionApiTest::SetUpCommandLine(command_line);
95 command_line->AppendSwitchASCII( 96 command_line->AppendSwitchASCII(
96 switches::kAppsGalleryURL, 97 switches::kAppsGalleryURL,
97 "http://www.example.com/files/extensions/api_test"); 98 "http://www.example.com/files/extensions/api_test");
98 command_line->AppendSwitchASCII( 99 command_line->AppendSwitchASCII(
99 switches::kAppsGalleryInstallAutoConfirmForTests, "accept"); 100 ::switches::kAppsGalleryInstallAutoConfirmForTests, "accept");
100 } 101 }
101 102
102 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 103 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
103 // Start up the test server and get us ready for calling the install 104 // Start up the test server and get us ready for calling the install
104 // API functions. 105 // API functions.
105 host_resolver()->AddRule("www.example.com", "127.0.0.1"); 106 host_resolver()->AddRule("www.example.com", "127.0.0.1");
106 ASSERT_TRUE(test_server()->Start()); 107 ASSERT_TRUE(test_server()->Start());
107 ExtensionInstallUI::set_disable_failure_ui_for_tests(); 108 ExtensionInstallUI::set_disable_failure_ui_for_tests();
108 } 109 }
109 110
(...skipping 15 matching lines...) Expand all
125 126
126 // Navigates to |page| and runs the Extension API test there. Any downloads 127 // Navigates to |page| and runs the Extension API test there. Any downloads
127 // of extensions will return the contents of |crx_file|. 128 // of extensions will return the contents of |crx_file|.
128 bool RunInstallTest(const std::string& page, const std::string& crx_file) { 129 bool RunInstallTest(const std::string& page, const std::string& crx_file) {
129 #if defined(OS_WIN) && !defined(NDEBUG) 130 #if defined(OS_WIN) && !defined(NDEBUG)
130 // See http://crbug.com/177163 for details. 131 // See http://crbug.com/177163 for details.
131 return true; 132 return true;
132 #else 133 #else
133 GURL crx_url = GetTestServerURL(crx_file); 134 GURL crx_url = GetTestServerURL(crx_file);
134 CommandLine::ForCurrentProcess()->AppendSwitchASCII( 135 CommandLine::ForCurrentProcess()->AppendSwitchASCII(
135 switches::kAppsGalleryUpdateURL, crx_url.spec()); 136 ::switches::kAppsGalleryUpdateURL, crx_url.spec());
136 137
137 GURL page_url = GetTestServerURL(page); 138 GURL page_url = GetTestServerURL(page);
138 return RunPageTest(page_url.spec()); 139 return RunPageTest(page_url.spec());
139 #endif 140 #endif
140 } 141 }
141 142
142 ExtensionService* service() { 143 ExtensionService* service() {
143 return browser()->profile()->GetExtensionService(); 144 return browser()->profile()->GetExtensionService();
144 } 145 }
145 }; 146 };
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 } 203 }
203 204
204 // Tests passing a localized name. 205 // Tests passing a localized name.
205 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, InstallLocalized) { 206 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, InstallLocalized) {
206 ASSERT_TRUE(RunInstallTest("localized.html", "localized_extension.crx")); 207 ASSERT_TRUE(RunInstallTest("localized.html", "localized_extension.crx"));
207 } 208 }
208 209
209 // Now test the case where the user cancels the confirmation dialog. 210 // Now test the case where the user cancels the confirmation dialog.
210 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, InstallCancelled) { 211 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, InstallCancelled) {
211 CommandLine::ForCurrentProcess()->AppendSwitchASCII( 212 CommandLine::ForCurrentProcess()->AppendSwitchASCII(
212 switches::kAppsGalleryInstallAutoConfirmForTests, "cancel"); 213 ::switches::kAppsGalleryInstallAutoConfirmForTests, "cancel");
213 ASSERT_TRUE(RunInstallTest("cancelled.html", "extension.crx")); 214 ASSERT_TRUE(RunInstallTest("cancelled.html", "extension.crx"));
214 } 215 }
215 216
216 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, IncorrectManifest1) { 217 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, IncorrectManifest1) {
217 ASSERT_TRUE(RunInstallTest("incorrect_manifest1.html", "extension.crx")); 218 ASSERT_TRUE(RunInstallTest("incorrect_manifest1.html", "extension.crx"));
218 } 219 }
219 220
220 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, IncorrectManifest2) { 221 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, IncorrectManifest2) {
221 ASSERT_TRUE(RunInstallTest("incorrect_manifest2.html", "extension.crx")); 222 ASSERT_TRUE(RunInstallTest("incorrect_manifest2.html", "extension.crx"));
222 } 223 }
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 content::GpuDataManager::GetInstance()->InitializeForTesting( 355 content::GpuDataManager::GetInstance()->InitializeForTesting(
355 json_blacklist, gpu_info); 356 json_blacklist, gpu_info);
356 EXPECT_TRUE(content::GpuDataManager::GetInstance()->IsFeatureBlacklisted( 357 EXPECT_TRUE(content::GpuDataManager::GetInstance()->IsFeatureBlacklisted(
357 gpu::GPU_FEATURE_TYPE_WEBGL)); 358 gpu::GPU_FEATURE_TYPE_WEBGL));
358 359
359 bool webgl_allowed = false; 360 bool webgl_allowed = false;
360 RunTest(webgl_allowed); 361 RunTest(webgl_allowed);
361 } 362 }
362 363
363 } // namespace extensions 364 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/kiosk_browsertest.cc ('k') | chrome/browser/extensions/webstore_data_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698