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

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

Issue 410683008: Remove kAppsGalleryInstallAutoConfirmForTests switch (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 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"
6 #include "chrome/browser/extensions/extension_install_prompt.h" 5 #include "chrome/browser/extensions/extension_install_prompt.h"
7 #include "chrome/browser/extensions/extension_service.h" 6 #include "chrome/browser/extensions/extension_service.h"
8 #include "chrome/browser/extensions/tab_helper.h" 7 #include "chrome/browser/extensions/tab_helper.h"
9 #include "chrome/browser/extensions/webstore_inline_installer.h" 8 #include "chrome/browser/extensions/webstore_inline_installer.h"
10 #include "chrome/browser/extensions/webstore_inline_installer_factory.h" 9 #include "chrome/browser/extensions/webstore_inline_installer_factory.h"
11 #include "chrome/browser/extensions/webstore_installer_test.h" 10 #include "chrome/browser/extensions/webstore_installer_test.h"
12 #include "chrome/browser/extensions/webstore_standalone_installer.h" 11 #include "chrome/browser/extensions/webstore_standalone_installer.h"
13 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/tabs/tab_strip_model.h" 14 #include "chrome/browser/ui/tabs/tab_strip_model.h"
16 #include "chrome/common/chrome_switches.h"
17 #include "chrome/test/base/ui_test_utils.h" 15 #include "chrome/test/base/ui_test_utils.h"
18 #include "content/public/browser/web_contents.h" 16 #include "content/public/browser/web_contents.h"
19 #include "extensions/browser/extension_system.h" 17 #include "extensions/browser/extension_system.h"
20 #include "url/gurl.h" 18 #include "url/gurl.h"
21 19
22 using content::WebContents; 20 using content::WebContents;
23 21
24 namespace extensions { 22 namespace extensions {
25 23
26 namespace { 24 namespace {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 while (!ProgrammableInstallPrompt::Ready()) 136 while (!ProgrammableInstallPrompt::Ready())
139 base::RunLoop().RunUntilIdle(); 137 base::RunLoop().RunUntilIdle();
140 web_contents->Close(); 138 web_contents->Close();
141 ProgrammableInstallPrompt::Accept(); 139 ProgrammableInstallPrompt::Accept();
142 } 140 }
143 141
144 // Ensure that inline-installing a disabled extension simply re-enables it. 142 // Ensure that inline-installing a disabled extension simply re-enables it.
145 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerTest, 143 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerTest,
146 ReinstallDisabledExtension) { 144 ReinstallDisabledExtension) {
147 // Install an extension via inline install, and confirm it is successful. 145 // Install an extension via inline install, and confirm it is successful.
148 CommandLine::ForCurrentProcess()->AppendSwitchASCII( 146 ExtensionInstallPrompt::g_auto_confirm_for_tests =
149 switches::kAppsGalleryInstallAutoConfirmForTests, "accept"); 147 ExtensionInstallPrompt::ACCEPT;
150 ui_test_utils::NavigateToURL( 148 ui_test_utils::NavigateToURL(
151 browser(), GenerateTestServerUrl(kAppDomain, "install.html")); 149 browser(), GenerateTestServerUrl(kAppDomain, "install.html"));
152 RunTest("runTest"); 150 RunTest("runTest");
153 ExtensionService* extension_service = 151 ExtensionService* extension_service =
154 ExtensionSystem::Get(browser()->profile())->extension_service(); 152 ExtensionSystem::Get(browser()->profile())->extension_service();
155 ASSERT_TRUE(extension_service->GetExtensionById(kTestExtensionId, false)); 153 ASSERT_TRUE(extension_service->GetExtensionById(kTestExtensionId, false));
156 154
157 // Disable the extension. 155 // Disable the extension.
158 extension_service->DisableExtension(kTestExtensionId, 156 extension_service->DisableExtension(kTestExtensionId,
159 Extension::DISABLE_USER_ACTION); 157 Extension::DISABLE_USER_ACTION);
160 ASSERT_FALSE(extension_service->IsExtensionEnabled(kTestExtensionId)); 158 ASSERT_FALSE(extension_service->IsExtensionEnabled(kTestExtensionId));
161 159
162 // Revisit the inline install site and reinstall the extension. It should 160 // Revisit the inline install site and reinstall the extension. It should
163 // simply be re-enabled, rather than try to install again. 161 // simply be re-enabled, rather than try to install again.
164 ui_test_utils::NavigateToURL( 162 ui_test_utils::NavigateToURL(
165 browser(), GenerateTestServerUrl(kAppDomain, "install.html")); 163 browser(), GenerateTestServerUrl(kAppDomain, "install.html"));
166 RunTest("runTest"); 164 RunTest("runTest");
167 ASSERT_TRUE(extension_service->IsExtensionEnabled(kTestExtensionId)); 165 ASSERT_TRUE(extension_service->IsExtensionEnabled(kTestExtensionId));
168 } 166 }
169 167
170 class WebstoreInlineInstallerListenerTest : public WebstoreInlineInstallerTest { 168 class WebstoreInlineInstallerListenerTest : public WebstoreInlineInstallerTest {
171 public: 169 public:
172 WebstoreInlineInstallerListenerTest() {} 170 WebstoreInlineInstallerListenerTest() {}
173 virtual ~WebstoreInlineInstallerListenerTest() {} 171 virtual ~WebstoreInlineInstallerListenerTest() {}
174 172
175 protected: 173 protected:
176 void RunTest(const std::string& file_name) { 174 void RunTest(const std::string& file_name) {
177 CommandLine::ForCurrentProcess()->AppendSwitchASCII( 175 ExtensionInstallPrompt::g_auto_confirm_for_tests =
178 switches::kAppsGalleryInstallAutoConfirmForTests, "accept"); 176 ExtensionInstallPrompt::ACCEPT;
179 ui_test_utils::NavigateToURL(browser(), 177 ui_test_utils::NavigateToURL(browser(),
180 GenerateTestServerUrl(kAppDomain, file_name)); 178 GenerateTestServerUrl(kAppDomain, file_name));
181 WebstoreInstallerTest::RunTest("runTest"); 179 WebstoreInstallerTest::RunTest("runTest");
182 } 180 }
183 }; 181 };
184 182
185 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerListenerTest, 183 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerListenerTest,
186 InstallStageListenerTest) { 184 InstallStageListenerTest) {
187 RunTest("install_stage_listener.html"); 185 RunTest("install_stage_listener.html");
188 } 186 }
189 187
190 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerListenerTest, 188 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerListenerTest,
191 DownloadProgressListenerTest) { 189 DownloadProgressListenerTest) {
192 RunTest("download_progress_listener.html"); 190 RunTest("download_progress_listener.html");
193 } 191 }
194 192
195 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerListenerTest, BothListenersTest) { 193 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerListenerTest, BothListenersTest) {
196 RunTest("both_listeners.html"); 194 RunTest("both_listeners.html");
197 } 195 }
198 196
199 } // namespace extensions 197 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/unpacked_installer.cc ('k') | chrome/browser/extensions/webstore_installer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698