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

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

Issue 10535077: TabContentsWrapper -> TabContents, part 12. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 6 months 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) 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_dialog.h" 9 #include "chrome/browser/extensions/extension_install_dialog.h"
10 #include "chrome/browser/extensions/extension_install_ui.h" 10 #include "chrome/browser/extensions/extension_install_ui.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 GURL::Replacements replace_host; 70 GURL::Replacements replace_host;
71 replace_host.SetHostStr(domain); 71 replace_host.SetHostStr(domain);
72 return page_url.ReplaceComponents(replace_host); 72 return page_url.ReplaceComponents(replace_host);
73 } 73 }
74 74
75 void RunInlineInstallTest(const std::string& test_function_name) { 75 void RunInlineInstallTest(const std::string& test_function_name) {
76 bool result = false; 76 bool result = false;
77 std::string script = StringPrintf("%s('%s')", test_function_name.c_str(), 77 std::string script = StringPrintf("%s('%s')", test_function_name.c_str(),
78 test_gallery_url_.c_str()); 78 test_gallery_url_.c_str());
79 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( 79 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
80 browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", 80 browser()->GetActiveWebContents()->GetRenderViewHost(), L"",
81 UTF8ToWide(script), &result)); 81 UTF8ToWide(script), &result));
82 EXPECT_TRUE(result); 82 EXPECT_TRUE(result);
83 } 83 }
84 84
85 std::string test_gallery_url_; 85 std::string test_gallery_url_;
86 }; 86 };
87 87
88 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallTest, Install) { 88 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallTest, Install) {
89 CommandLine::ForCurrentProcess()->AppendSwitchASCII( 89 CommandLine::ForCurrentProcess()->AppendSwitchASCII(
90 switches::kAppsGalleryInstallAutoConfirmForTests, "accept"); 90 switches::kAppsGalleryInstallAutoConfirmForTests, "accept");
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 browser(), 135 browser(),
136 GenerateTestServerUrl(kAppDomain, "install_not_supported.html")); 136 GenerateTestServerUrl(kAppDomain, "install_not_supported.html"));
137 137
138 RunInlineInstallTest("runTest"); 138 RunInlineInstallTest("runTest");
139 139
140 // The inline install should fail, and a store-provided URL should be opened 140 // The inline install should fail, and a store-provided URL should be opened
141 // in a new tab. 141 // in a new tab.
142 if (browser()->tab_strip_model()->count() == 1) { 142 if (browser()->tab_strip_model()->count() == 1) {
143 ui_test_utils::WaitForNewTab(browser()); 143 ui_test_utils::WaitForNewTab(browser());
144 } 144 }
145 WebContents* web_contents = browser()->GetSelectedWebContents(); 145 WebContents* web_contents = browser()->GetActiveWebContents();
146 EXPECT_EQ(GURL("http://cws.com/show-me-the-money"), web_contents->GetURL()); 146 EXPECT_EQ(GURL("http://cws.com/show-me-the-money"), web_contents->GetURL());
147 } 147 }
148 148
149 // The unpack failure test needs to use a different install .crx, which is 149 // The unpack failure test needs to use a different install .crx, which is
150 // specified via a command-line flag, so it needs its own test subclass. 150 // specified via a command-line flag, so it needs its own test subclass.
151 class WebstoreInlineInstallUnpackFailureTest 151 class WebstoreInlineInstallUnpackFailureTest
152 : public WebstoreInlineInstallTest { 152 : public WebstoreInlineInstallTest {
153 public: 153 public:
154 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 154 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
155 WebstoreInlineInstallTest::SetUpCommandLine(command_line); 155 WebstoreInlineInstallTest::SetUpCommandLine(command_line);
(...skipping 13 matching lines...) Expand all
169 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallUnpackFailureTest, 169 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallUnpackFailureTest,
170 WebstoreInlineInstallUnpackFailureTest) { 170 WebstoreInlineInstallUnpackFailureTest) {
171 CommandLine::ForCurrentProcess()->AppendSwitchASCII( 171 CommandLine::ForCurrentProcess()->AppendSwitchASCII(
172 switches::kAppsGalleryInstallAutoConfirmForTests, "accept"); 172 switches::kAppsGalleryInstallAutoConfirmForTests, "accept");
173 173
174 ui_test_utils::NavigateToURL(browser(), 174 ui_test_utils::NavigateToURL(browser(),
175 GenerateTestServerUrl(kAppDomain, "install_unpack_failure.html")); 175 GenerateTestServerUrl(kAppDomain, "install_unpack_failure.html"));
176 176
177 RunInlineInstallTest("runTest"); 177 RunInlineInstallTest("runTest");
178 } 178 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/script_badge_controller.cc ('k') | chrome/browser/extensions/webstore_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698