OLD | NEW |
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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/stringprintf.h" | 6 #include "base/stringprintf.h" |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/extensions/extension_host.h" | 8 #include "chrome/browser/extensions/extension_host.h" |
9 #include "chrome/browser/extensions/extension_install_ui.h" | 9 #include "chrome/browser/extensions/extension_install_ui.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 GURL::Replacements replace_host; | 78 GURL::Replacements replace_host; |
79 replace_host.SetHostStr(domain); | 79 replace_host.SetHostStr(domain); |
80 return page_url.ReplaceComponents(replace_host); | 80 return page_url.ReplaceComponents(replace_host); |
81 } | 81 } |
82 | 82 |
83 void RunTest(const std::string& test_function_name) { | 83 void RunTest(const std::string& test_function_name) { |
84 bool result = false; | 84 bool result = false; |
85 std::string script = StringPrintf("%s('%s')", test_function_name.c_str(), | 85 std::string script = StringPrintf("%s('%s')", test_function_name.c_str(), |
86 test_gallery_url_.c_str()); | 86 test_gallery_url_.c_str()); |
87 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool( | 87 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool( |
88 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"", | 88 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), |
89 UTF8ToWide(script), &result)); | 89 "", |
| 90 script, |
| 91 &result)); |
90 EXPECT_TRUE(result); | 92 EXPECT_TRUE(result); |
91 } | 93 } |
92 | 94 |
93 std::string test_gallery_url_; | 95 std::string test_gallery_url_; |
94 }; | 96 }; |
95 | 97 |
96 IN_PROC_BROWSER_TEST_F(WebstoreStandaloneInstallTest, Install) { | 98 IN_PROC_BROWSER_TEST_F(WebstoreStandaloneInstallTest, Install) { |
97 CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 99 CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
98 switches::kAppsGalleryInstallAutoConfirmForTests, "accept"); | 100 switches::kAppsGalleryInstallAutoConfirmForTests, "accept"); |
99 | 101 |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 | 278 |
277 IN_PROC_BROWSER_TEST_F(CommandLineWebstoreInstall, Cancel) { | 279 IN_PROC_BROWSER_TEST_F(CommandLineWebstoreInstall, Cancel) { |
278 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 280 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
279 command_line->AppendSwitchASCII( | 281 command_line->AppendSwitchASCII( |
280 switches::kAppsGalleryInstallAutoConfirmForTests, "cancel"); | 282 switches::kAppsGalleryInstallAutoConfirmForTests, "cancel"); |
281 extensions::StartupHelper helper; | 283 extensions::StartupHelper helper; |
282 EXPECT_FALSE(helper.InstallFromWebstore(*command_line, browser()->profile())); | 284 EXPECT_FALSE(helper.InstallFromWebstore(*command_line, browser()->profile())); |
283 EXPECT_FALSE(saw_install()); | 285 EXPECT_FALSE(saw_install()); |
284 EXPECT_EQ(0, browser_open_count()); | 286 EXPECT_EQ(0, browser_open_count()); |
285 } | 287 } |
OLD | NEW |