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