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

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

Issue 2716693002: Allow inline install for user initiated fullscreen mode (Closed)
Patch Set: Created 3 years, 10 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
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 "chrome/browser/extensions/webstore_inline_installer.h" 5 #include "chrome/browser/extensions/webstore_inline_installer.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 10 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 ui_test_utils::NavigateToURL(browser(), install_url); 249 ui_test_utils::NavigateToURL(browser(), install_url);
250 // The test page opens a popup which is a new |browser| window. 250 // The test page opens a popup which is a new |browser| window.
251 Browser* popup_browser = 251 Browser* popup_browser =
252 chrome::FindLastActiveWithProfile(browser()->profile()); 252 chrome::FindLastActiveWithProfile(browser()->profile());
253 WebContents* popup_contents = 253 WebContents* popup_contents =
254 popup_browser->tab_strip_model()->GetActiveWebContents(); 254 popup_browser->tab_strip_model()->GetActiveWebContents();
255 EXPECT_EQ(base::ASCIIToUTF16("POPUP"), popup_contents->GetTitle()); 255 EXPECT_EQ(base::ASCIIToUTF16("POPUP"), popup_contents->GetTitle());
256 RunTest(popup_contents, "runTest"); 256 RunTest(popup_contents, "runTest");
257 } 257 }
258 258
259 // Prevent inline install while in browser fullscreen mode. Browser fullscreen 259 // Allow inline install while in browser fullscreen mode. Browser fullscreen
260 // is initiated by the user using F11. 260 // is initiated by the user using F11 (windows), ctrl+cmd+F (mac) or the green
261 // maximize window button on mac. This will be allowed since it cannot be
262 // initiated by an API and because of the nuance with mac windows.
261 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerTest, 263 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerTest,
262 BlockInlineInstallFromFullscreenForBrowser) { 264 AllowInlineInstallFromFullscreenForBrowser) {
263 const GURL install_url = 265 const GURL install_url = GenerateTestServerUrl(kAppDomain, "install.html");
264 GenerateTestServerUrl(kAppDomain, "install_from_fullscreen.html");
265 ui_test_utils::NavigateToURL(browser(), install_url); 266 ui_test_utils::NavigateToURL(browser(), install_url);
266 AutoAcceptInstall(); 267 AutoAcceptInstall();
267 268
268 // Enter browser fullscreen mode. 269 // Enter browser fullscreen mode.
269 FullscreenController* controller = 270 FullscreenController* controller =
270 browser()->exclusive_access_manager()->fullscreen_controller(); 271 browser()->exclusive_access_manager()->fullscreen_controller();
271 controller->ToggleBrowserFullscreenMode(); 272 controller->ToggleBrowserFullscreenMode();
272 273
273 RunTest("runTest"); 274 RunTest("runTest");
274 275
275 // Ensure extension is not installed. 276 // Ensure extension is installed.
276 ExtensionRegistry* registry = ExtensionRegistry::Get(profile()); 277 ExtensionRegistry* registry = ExtensionRegistry::Get(profile());
277 EXPECT_FALSE(registry->GenerateInstalledExtensionsSet()->Contains( 278 EXPECT_TRUE(
278 "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb")); 279 registry->GenerateInstalledExtensionsSet()->Contains(kTestExtensionId));
279 } 280 }
280 281
281 // Prevent inline install while in tab fullscreen mode. Tab fullscreen is 282 // Prevent inline install while in tab fullscreen mode. Tab fullscreen is
282 // initiated using the browser API. 283 // initiated using the browser API.
283 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerTest, 284 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerTest,
284 BlockInlineInstallFromFullscreenForTab) { 285 BlockInlineInstallFromFullscreenForTab) {
285 const GURL install_url = 286 const GURL install_url =
286 GenerateTestServerUrl(kAppDomain, "install_from_fullscreen.html"); 287 GenerateTestServerUrl(kAppDomain, "install_from_fullscreen.html");
287 ui_test_utils::NavigateToURL(browser(), install_url); 288 ui_test_utils::NavigateToURL(browser(), install_url);
288 AutoAcceptInstall(); 289 AutoAcceptInstall();
289 WebContents* web_contents = 290 WebContents* web_contents =
290 browser()->tab_strip_model()->GetActiveWebContents(); 291 browser()->tab_strip_model()->GetActiveWebContents();
291 FullscreenController* controller = 292 FullscreenController* controller =
292 browser()->exclusive_access_manager()->fullscreen_controller(); 293 browser()->exclusive_access_manager()->fullscreen_controller();
293 294
294 // Enter tab fullscreen mode. 295 // Enter tab fullscreen mode.
295 controller->EnterFullscreenModeForTab(web_contents, install_url); 296 controller->EnterFullscreenModeForTab(web_contents, install_url);
296 297
297 RunTest("runTest"); 298 RunTest("runTest");
298 299
299 // Ensure extension is not installed. 300 // Ensure extension is not installed.
300 ExtensionRegistry* registry = ExtensionRegistry::Get(profile()); 301 ExtensionRegistry* registry = ExtensionRegistry::Get(profile());
301 EXPECT_FALSE(registry->GenerateInstalledExtensionsSet()->Contains( 302 EXPECT_FALSE(
302 "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb")); 303 registry->GenerateInstalledExtensionsSet()->Contains(kTestExtensionId));
303 } 304 }
304 305
305 // Ensure that inline-installing a disabled extension simply re-enables it. 306 // Ensure that inline-installing a disabled extension simply re-enables it.
306 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerTest, 307 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerTest,
307 ReinstallDisabledExtension) { 308 ReinstallDisabledExtension) {
308 // Install an extension via inline install, and confirm it is successful. 309 // Install an extension via inline install, and confirm it is successful.
309 AutoAcceptInstall(); 310 AutoAcceptInstall();
310 ui_test_utils::NavigateToURL( 311 ui_test_utils::NavigateToURL(
311 browser(), GenerateTestServerUrl(kAppDomain, "install.html")); 312 browser(), GenerateTestServerUrl(kAppDomain, "install.html"));
312 RunTest("runTest"); 313 RunTest("runTest");
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 WindowOpenDisposition::NEW_FOREGROUND_TAB, 407 WindowOpenDisposition::NEW_FOREGROUND_TAB,
407 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 408 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
408 DCHECK_NE(old_tab_index, browser()->tab_strip_model()->active_index()); 409 DCHECK_NE(old_tab_index, browser()->tab_strip_model()->active_index());
409 browser()->tab_strip_model()->CloseWebContentsAt(old_tab_index, 410 browser()->tab_strip_model()->CloseWebContentsAt(old_tab_index,
410 TabStripModel::CLOSE_NONE); 411 TabStripModel::CLOSE_NONE);
411 WebstoreInstallerTest::RunTest("runTest"); 412 WebstoreInstallerTest::RunTest("runTest");
412 EXPECT_TRUE(registry->enabled_extensions().GetByID(kTestExtensionId)); 413 EXPECT_TRUE(registry->enabled_extensions().GetByID(kTestExtensionId));
413 } 414 }
414 415
415 } // namespace extensions 416 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698