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

Side by Side Diff: chrome/browser/extensions/webstore_installer_test.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/strings/stringprintf.h" 6 #include "base/strings/stringprintf.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/extensions/extension_install_prompt.h" 8 #include "chrome/browser/extensions/extension_install_prompt.h"
9 #include "chrome/browser/extensions/tab_helper.h" 9 #include "chrome/browser/extensions/tab_helper.h"
10 #include "chrome/browser/extensions/webstore_inline_installer.h" 10 #include "chrome/browser/extensions/webstore_inline_installer.h"
11 #include "chrome/browser/extensions/webstore_inline_installer_factory.h" 11 #include "chrome/browser/extensions/webstore_inline_installer_factory.h"
12 #include "chrome/browser/extensions/webstore_installer_test.h" 12 #include "chrome/browser/extensions/webstore_installer_test.h"
13 #include "chrome/browser/extensions/webstore_standalone_installer.h" 13 #include "chrome/browser/extensions/webstore_standalone_installer.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/tabs/tab_strip_model.h" 16 #include "chrome/browser/ui/tabs/tab_strip_model.h"
17 #include "chrome/common/chrome_switches.h" 17 #include "chrome/common/chrome_switches.h"
18 #include "chrome/test/base/in_process_browser_test.h" 18 #include "chrome/test/base/in_process_browser_test.h"
19 #include "chrome/test/base/test_switches.h" 19 #include "chrome/test/base/test_switches.h"
20 #include "chrome/test/base/ui_test_utils.h" 20 #include "chrome/test/base/ui_test_utils.h"
21 #include "content/public/browser/notification_registrar.h" 21 #include "content/public/browser/notification_registrar.h"
22 #include "content/public/browser/notification_service.h" 22 #include "content/public/browser/notification_service.h"
23 #include "content/public/browser/notification_types.h" 23 #include "content/public/browser/notification_types.h"
24 #include "content/public/browser/render_view_host.h" 24 #include "content/public/browser/render_view_host.h"
25 #include "content/public/browser/web_contents.h" 25 #include "content/public/browser/web_contents.h"
26 #include "content/public/test/browser_test_utils.h" 26 #include "content/public/test/browser_test_utils.h"
27 #include "extensions/common/switches.h"
27 #include "net/base/host_port_pair.h" 28 #include "net/base/host_port_pair.h"
28 #include "net/dns/mock_host_resolver.h" 29 #include "net/dns/mock_host_resolver.h"
29 #include "url/gurl.h" 30 #include "url/gurl.h"
30 31
31 using content::WebContents; 32 using content::WebContents;
32 using extensions::Extension; 33 using extensions::Extension;
33 using extensions::TabHelper; 34 using extensions::TabHelper;
34 using extensions::WebstoreInlineInstaller; 35 using extensions::WebstoreInlineInstaller;
35 using extensions::WebstoreInlineInstallerFactory; 36 using extensions::WebstoreInlineInstallerFactory;
36 using extensions::WebstoreStandaloneInstaller; 37 using extensions::WebstoreStandaloneInstaller;
(...skipping 16 matching lines...) Expand all
53 void WebstoreInstallerTest::SetUpCommandLine(CommandLine* command_line) { 54 void WebstoreInstallerTest::SetUpCommandLine(CommandLine* command_line) {
54 // We start the test server now instead of in 55 // We start the test server now instead of in
55 // SetUpInProcessBrowserTestFixture so that we can get its port number. 56 // SetUpInProcessBrowserTestFixture so that we can get its port number.
56 ASSERT_TRUE(test_server()->Start()); 57 ASSERT_TRUE(test_server()->Start());
57 58
58 net::HostPortPair host_port = test_server()->host_port_pair(); 59 net::HostPortPair host_port = test_server()->host_port_pair();
59 test_gallery_url_ = base::StringPrintf( 60 test_gallery_url_ = base::StringPrintf(
60 "http://%s:%d/files/%s", 61 "http://%s:%d/files/%s",
61 webstore_domain_.c_str(), host_port.port(), test_data_path_.c_str()); 62 webstore_domain_.c_str(), host_port.port(), test_data_path_.c_str());
62 command_line->AppendSwitchASCII( 63 command_line->AppendSwitchASCII(
63 switches::kAppsGalleryURL, test_gallery_url_); 64 extensions::switches::kAppsGalleryURL, test_gallery_url_);
64 65
65 GURL crx_url = GenerateTestServerUrl(webstore_domain_, crx_filename_); 66 GURL crx_url = GenerateTestServerUrl(webstore_domain_, crx_filename_);
66 CommandLine::ForCurrentProcess()->AppendSwitchASCII( 67 CommandLine::ForCurrentProcess()->AppendSwitchASCII(
67 switches::kAppsGalleryUpdateURL, crx_url.spec()); 68 switches::kAppsGalleryUpdateURL, crx_url.spec());
68 69
69 // Allow tests to call window.gc(), so that we can check that callback 70 // Allow tests to call window.gc(), so that we can check that callback
70 // functions don't get collected prematurely. 71 // functions don't get collected prematurely.
71 command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose-gc"); 72 command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose-gc");
72 } 73 }
73 74
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 119
119 void WebstoreInstallerTest::RunTestAsync( 120 void WebstoreInstallerTest::RunTestAsync(
120 const std::string& test_function_name) { 121 const std::string& test_function_name) {
121 std::string script = base::StringPrintf( 122 std::string script = base::StringPrintf(
122 "%s('%s')", test_function_name.c_str(), test_gallery_url_.c_str()); 123 "%s('%s')", test_function_name.c_str(), test_gallery_url_.c_str());
123 browser()->tab_strip_model()->GetActiveWebContents()->GetRenderViewHost()-> 124 browser()->tab_strip_model()->GetActiveWebContents()->GetRenderViewHost()->
124 ExecuteJavascriptInWebFrame( 125 ExecuteJavascriptInWebFrame(
125 UTF8ToUTF16(std::string()), 126 UTF8ToUTF16(std::string()),
126 UTF8ToUTF16(script)); 127 UTF8ToUTF16(script));
127 } 128 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/webstore_data_fetcher.cc ('k') | chrome/browser/extensions/webstore_standalone_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698