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

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

Issue 2693183002: Allow inline install for user initiated fullscreen mode. (Closed)
Patch Set: Adding test to ensure browser for fullscreen is allowed to inline install and commenting on why it'… 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
« no previous file with comments | « chrome/browser/extensions/webstore_inline_installer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 ui_test_utils::NavigateToURL(browser(), install_url); 256 ui_test_utils::NavigateToURL(browser(), install_url);
257 // The test page opens a popup which is a new |browser| window. 257 // The test page opens a popup which is a new |browser| window.
258 Browser* popup_browser = 258 Browser* popup_browser =
259 chrome::FindLastActiveWithProfile(browser()->profile()); 259 chrome::FindLastActiveWithProfile(browser()->profile());
260 WebContents* popup_contents = 260 WebContents* popup_contents =
261 popup_browser->tab_strip_model()->GetActiveWebContents(); 261 popup_browser->tab_strip_model()->GetActiveWebContents();
262 EXPECT_EQ(base::ASCIIToUTF16("POPUP"), popup_contents->GetTitle()); 262 EXPECT_EQ(base::ASCIIToUTF16("POPUP"), popup_contents->GetTitle());
263 RunTest(popup_contents, "runTest"); 263 RunTest(popup_contents, "runTest");
264 } 264 }
265 265
266 // Prevent inline install while in browser fullscreen mode. Browser fullscreen 266 // Allow inline install while in browser fullscreen mode. Browser fullscreen
267 // is initiated by the user using F11. 267 // is initiated by the user using F11 (windows), ctrl+cmd+F (mac) or the green
268 // maximize window button on mac. This will be allowed since it cannot be
269 // initiated by an API and because of the nuance with mac windows.
268 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerTest, 270 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerTest,
269 BlockInlineInstallFromFullscreenForBrowser) { 271 AllowInlineInstallFromFullscreenForBrowser) {
270 const GURL install_url = 272 const GURL install_url = GenerateTestServerUrl(kAppDomain, "install.html");
271 GenerateTestServerUrl(kAppDomain, "install_from_fullscreen.html");
272 ui_test_utils::NavigateToURL(browser(), install_url); 273 ui_test_utils::NavigateToURL(browser(), install_url);
273 AutoAcceptInstall(); 274 AutoAcceptInstall();
274 275
275 // Enter browser fullscreen mode. 276 // Enter browser fullscreen mode.
276 FullscreenController* controller = 277 FullscreenController* controller =
277 browser()->exclusive_access_manager()->fullscreen_controller(); 278 browser()->exclusive_access_manager()->fullscreen_controller();
278 controller->ToggleBrowserFullscreenMode(); 279 controller->ToggleBrowserFullscreenMode();
279 280
280 RunTest("runTest"); 281 RunTest("runTest");
281 282
282 // Ensure extension is not installed. 283 // Ensure extension is installed.
283 ExtensionRegistry* registry = ExtensionRegistry::Get(profile()); 284 ExtensionRegistry* registry = ExtensionRegistry::Get(profile());
284 EXPECT_FALSE(registry->GenerateInstalledExtensionsSet()->Contains( 285 EXPECT_TRUE(registry->GenerateInstalledExtensionsSet()->Contains(
285 "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb")); 286 "ecglahbcnmdpdciemllbhojghbkagdje"));
Devlin 2017/02/15 15:48:06 huh. b.repeat(32) wasn't the id? Does that mean
Devlin 2017/02/15 17:01:12 nvm, all cleared up (but still please use kTestExt
Ackerman 2017/02/15 17:28:39 Done.
286 } 287 }
287 288
288 // Prevent inline install while in tab fullscreen mode. Tab fullscreen is 289 // Prevent inline install while in tab fullscreen mode. Tab fullscreen is
289 // initiated using the browser API. 290 // initiated using the browser API.
290 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerTest, 291 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerTest,
291 BlockInlineInstallFromFullscreenForTab) { 292 BlockInlineInstallFromFullscreenForTab) {
292 const GURL install_url = 293 const GURL install_url =
293 GenerateTestServerUrl(kAppDomain, "install_from_fullscreen.html"); 294 GenerateTestServerUrl(kAppDomain, "install_from_fullscreen.html");
294 ui_test_utils::NavigateToURL(browser(), install_url); 295 ui_test_utils::NavigateToURL(browser(), install_url);
295 AutoAcceptInstall(); 296 AutoAcceptInstall();
296 WebContents* web_contents = 297 WebContents* web_contents =
297 browser()->tab_strip_model()->GetActiveWebContents(); 298 browser()->tab_strip_model()->GetActiveWebContents();
298 FullscreenController* controller = 299 FullscreenController* controller =
299 browser()->exclusive_access_manager()->fullscreen_controller(); 300 browser()->exclusive_access_manager()->fullscreen_controller();
300 301
301 // Enter tab fullscreen mode. 302 // Enter tab fullscreen mode.
302 controller->EnterFullscreenModeForTab(web_contents, install_url); 303 controller->EnterFullscreenModeForTab(web_contents, install_url);
303 304
304 RunTest("runTest"); 305 RunTest("runTest");
305 306
306 // Ensure extension is not installed. 307 // Ensure extension is not installed.
307 ExtensionRegistry* registry = ExtensionRegistry::Get(profile()); 308 ExtensionRegistry* registry = ExtensionRegistry::Get(profile());
308 EXPECT_FALSE(registry->GenerateInstalledExtensionsSet()->Contains( 309 EXPECT_FALSE(registry->GenerateInstalledExtensionsSet()->Contains(
309 "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb")); 310 "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"));
Devlin 2017/02/15 15:48:05 In line with the above, seems like this should be
Devlin 2017/02/15 17:01:12 ignore
Ackerman 2017/02/15 17:28:39 Updated to use the test extension id in install_fr
310 } 311 }
311 312
312 // Ensure that inline-installing a disabled extension simply re-enables it. 313 // Ensure that inline-installing a disabled extension simply re-enables it.
313 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerTest, 314 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerTest,
314 ReinstallDisabledExtension) { 315 ReinstallDisabledExtension) {
315 // Install an extension via inline install, and confirm it is successful. 316 // Install an extension via inline install, and confirm it is successful.
316 AutoAcceptInstall(); 317 AutoAcceptInstall();
317 ui_test_utils::NavigateToURL( 318 ui_test_utils::NavigateToURL(
318 browser(), GenerateTestServerUrl(kAppDomain, "install.html")); 319 browser(), GenerateTestServerUrl(kAppDomain, "install.html"));
319 RunTest("runTest"); 320 RunTest("runTest");
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 WindowOpenDisposition::NEW_FOREGROUND_TAB, 483 WindowOpenDisposition::NEW_FOREGROUND_TAB,
483 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 484 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
484 DCHECK_NE(old_tab_index, browser()->tab_strip_model()->active_index()); 485 DCHECK_NE(old_tab_index, browser()->tab_strip_model()->active_index());
485 browser()->tab_strip_model()->CloseWebContentsAt(old_tab_index, 486 browser()->tab_strip_model()->CloseWebContentsAt(old_tab_index,
486 TabStripModel::CLOSE_NONE); 487 TabStripModel::CLOSE_NONE);
487 WebstoreInstallerTest::RunTest("runTest"); 488 WebstoreInstallerTest::RunTest("runTest");
488 EXPECT_TRUE(registry->enabled_extensions().GetByID(kTestExtensionId)); 489 EXPECT_TRUE(registry->enabled_extensions().GetByID(kTestExtensionId));
489 } 490 }
490 491
491 } // namespace extensions 492 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/webstore_inline_installer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698