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

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

Issue 4727001: Split the private webstore install API into two parts.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_webstore_private_api.h" 7 #include "chrome/browser/extensions/extension_webstore_private_api.h"
8 #include "chrome/common/chrome_switches.h" 8 #include "chrome/common/chrome_switches.h"
9 #include "chrome/test/ui_test_utils.h" 9 #include "chrome/test/ui_test_utils.h"
10 #include "net/base/mock_host_resolver.h" 10 #include "net/base/mock_host_resolver.h"
11 11
12 class ExtensionGalleryInstallApiTest : public ExtensionApiTest { 12 class ExtensionGalleryInstallApiTest : public ExtensionApiTest {
13 public: 13 public:
14 void SetUpCommandLine(CommandLine* command_line) { 14 void SetUpCommandLine(CommandLine* command_line) {
15 ExtensionApiTest::SetUpCommandLine(command_line); 15 ExtensionApiTest::SetUpCommandLine(command_line);
16 command_line->AppendSwitchASCII(switches::kAppsGalleryURL, 16 command_line->AppendSwitchASCII(switches::kAppsGalleryURL,
17 "http://www.example.com"); 17 "http://www.example.com");
18 } 18 }
19
20 bool RunInstallTest(const std::string& page) {
21 std::string base_url = base::StringPrintf(
22 "http://www.example.com:%u/files/extensions/",
23 test_server()->host_port_pair().port());
24
25 std::string testing_install_base_url = base_url;
26 testing_install_base_url += "good.crx";
27 CompleteInstallFunction::SetTestingInstallBaseUrl(
28 testing_install_base_url.c_str());
29
30 std::string page_url = base_url;
31 page_url += "api_test/extension_gallery_install/" + page;
32
33 return RunPageTest(page_url.c_str());
34 }
19 }; 35 };
20 36
21 // http://crbug.com/55642 - failing on XP. 37 // http://crbug.com/55642 - failing on XP.
22 #if defined (OS_WIN) 38 #if defined (OS_WIN)
23 #define MAYBE_InstallAndUninstall DISABLED_InstallAndUninstall 39 #define MAYBE_InstallAndUninstall FLAKY_InstallAndUninstall
asargent_no_longer_on_chrome 2010/11/10 00:23:48 FYI, I'm changing this to FLAKY so I can see if it
24 #else 40 #else
25 #define MAYBE_InstallAndUninstall InstallAndUninstall 41 #define MAYBE_InstallAndUninstall InstallAndUninstall
26 #endif 42 #endif
27 IN_PROC_BROWSER_TEST_F(ExtensionGalleryInstallApiTest, 43 IN_PROC_BROWSER_TEST_F(ExtensionGalleryInstallApiTest,
28 MAYBE_InstallAndUninstall) { 44 MAYBE_InstallAndUninstall) {
29 host_resolver()->AddRule("www.example.com", "127.0.0.1"); 45 host_resolver()->AddRule("www.example.com", "127.0.0.1");
30 ASSERT_TRUE(test_server()->Start()); 46 ASSERT_TRUE(test_server()->Start());
31 47
32 std::string base_url = base::StringPrintf( 48 BeginInstallFunction::SetIgnoreUserGestureForTests(true);
33 "http://www.example.com:%u/files/extensions/", 49 ASSERT_TRUE(RunInstallTest("test.html"));
34 test_server()->host_port_pair().port()); 50 ASSERT_TRUE(RunInstallTest("complete_without_begin.html"));
51 ASSERT_TRUE(RunInstallTest("invalid_begin.html"));
35 52
36 std::string testing_install_base_url = base_url; 53 BeginInstallFunction::SetIgnoreUserGestureForTests(false);
37 testing_install_base_url += "good.crx"; 54 ASSERT_TRUE(RunInstallTest("no_user_gesture.html"));
38 InstallFunction::SetTestingInstallBaseUrl(testing_install_base_url.c_str());
39
40 std::string page_url = base_url;
41 page_url += "api_test/extension_gallery_install/test.html";
42 ASSERT_TRUE(RunPageTest(page_url.c_str()));
43 } 55 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698