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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
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::ExecuteScriptAndExtractBool( |
88 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), | 88 chrome::GetActiveWebContents(browser()), |
89 "", | |
90 script, | 89 script, |
91 &result)); | 90 &result)); |
92 EXPECT_TRUE(result); | 91 EXPECT_TRUE(result); |
93 } | 92 } |
94 | 93 |
95 std::string test_gallery_url_; | 94 std::string test_gallery_url_; |
96 }; | 95 }; |
97 | 96 |
98 IN_PROC_BROWSER_TEST_F(WebstoreStandaloneInstallTest, Install) { | 97 IN_PROC_BROWSER_TEST_F(WebstoreStandaloneInstallTest, Install) { |
99 CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 98 CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 | 277 |
279 IN_PROC_BROWSER_TEST_F(CommandLineWebstoreInstall, Cancel) { | 278 IN_PROC_BROWSER_TEST_F(CommandLineWebstoreInstall, Cancel) { |
280 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 279 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
281 command_line->AppendSwitchASCII( | 280 command_line->AppendSwitchASCII( |
282 switches::kAppsGalleryInstallAutoConfirmForTests, "cancel"); | 281 switches::kAppsGalleryInstallAutoConfirmForTests, "cancel"); |
283 extensions::StartupHelper helper; | 282 extensions::StartupHelper helper; |
284 EXPECT_FALSE(helper.InstallFromWebstore(*command_line, browser()->profile())); | 283 EXPECT_FALSE(helper.InstallFromWebstore(*command_line, browser()->profile())); |
285 EXPECT_FALSE(saw_install()); | 284 EXPECT_FALSE(saw_install()); |
286 EXPECT_EQ(0, browser_open_count()); | 285 EXPECT_EQ(0, browser_open_count()); |
287 } | 286 } |
OLD | NEW |