Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 | |
| 267 // is initiated by the user using F11. | |
| 268 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerTest, | |
| 269 BlockInlineInstallFromFullscreenForBrowser) { | |
|
Devlin
2017/02/14 23:19:52
Instead of deleting this, let's make it a test for
| |
| 270 const GURL install_url = | |
| 271 GenerateTestServerUrl(kAppDomain, "install_from_fullscreen.html"); | |
| 272 ui_test_utils::NavigateToURL(browser(), install_url); | |
| 273 AutoAcceptInstall(); | |
| 274 | |
| 275 // Enter browser fullscreen mode. | |
| 276 FullscreenController* controller = | |
| 277 browser()->exclusive_access_manager()->fullscreen_controller(); | |
| 278 controller->ToggleBrowserFullscreenMode(); | |
| 279 | |
| 280 RunTest("runTest"); | |
| 281 | |
| 282 // Ensure extension is not installed. | |
| 283 ExtensionRegistry* registry = ExtensionRegistry::Get(profile()); | |
| 284 EXPECT_FALSE(registry->GenerateInstalledExtensionsSet()->Contains( | |
| 285 "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb")); | |
| 286 } | |
| 287 | |
| 288 // Prevent inline install while in tab fullscreen mode. Tab fullscreen is | 266 // Prevent inline install while in tab fullscreen mode. Tab fullscreen is |
| 289 // initiated using the browser API. | 267 // initiated using the browser API. |
| 290 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerTest, | 268 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerTest, |
| 291 BlockInlineInstallFromFullscreenForTab) { | 269 BlockInlineInstallFromFullscreenForTab) { |
| 292 const GURL install_url = | 270 const GURL install_url = |
| 293 GenerateTestServerUrl(kAppDomain, "install_from_fullscreen.html"); | 271 GenerateTestServerUrl(kAppDomain, "install_from_fullscreen.html"); |
| 294 ui_test_utils::NavigateToURL(browser(), install_url); | 272 ui_test_utils::NavigateToURL(browser(), install_url); |
| 295 AutoAcceptInstall(); | 273 AutoAcceptInstall(); |
| 296 WebContents* web_contents = | 274 WebContents* web_contents = |
| 297 browser()->tab_strip_model()->GetActiveWebContents(); | 275 browser()->tab_strip_model()->GetActiveWebContents(); |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 482 WindowOpenDisposition::NEW_FOREGROUND_TAB, | 460 WindowOpenDisposition::NEW_FOREGROUND_TAB, |
| 483 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 461 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 484 DCHECK_NE(old_tab_index, browser()->tab_strip_model()->active_index()); | 462 DCHECK_NE(old_tab_index, browser()->tab_strip_model()->active_index()); |
| 485 browser()->tab_strip_model()->CloseWebContentsAt(old_tab_index, | 463 browser()->tab_strip_model()->CloseWebContentsAt(old_tab_index, |
| 486 TabStripModel::CLOSE_NONE); | 464 TabStripModel::CLOSE_NONE); |
| 487 WebstoreInstallerTest::RunTest("runTest"); | 465 WebstoreInstallerTest::RunTest("runTest"); |
| 488 EXPECT_TRUE(registry->enabled_extensions().GetByID(kTestExtensionId)); | 466 EXPECT_TRUE(registry->enabled_extensions().GetByID(kTestExtensionId)); |
| 489 } | 467 } |
| 490 | 468 |
| 491 } // namespace extensions | 469 } // namespace extensions |
| OLD | NEW |