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/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 Loading... | |
| 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 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerTest, | |
| 260 BlockInlineInstallFromFullscreenForBrowser) { | |
|
meacer
2016/10/10 17:57:33
nit: Can you add a comment for this test explainin
Ackerman
2016/10/10 19:35:58
Done.
| |
| 261 GURL install_url = | |
|
meacer
2016/10/10 17:57:33
nit: const GURL install_url =
Ackerman
2016/10/10 19:35:58
Done.
| |
| 262 GenerateTestServerUrl(kAppDomain, "install_from_fullscreen.html"); | |
| 263 ui_test_utils::NavigateToURL(browser(), install_url); | |
| 264 AutoAcceptInstall(); | |
|
meacer
2016/10/10 17:57:33
You probably don't need this since the dialog won'
Devlin
2016/10/10 18:35:59
I think I suggested this when Ben was talking to m
Ackerman
2016/10/10 19:35:58
Keeping per Devlin's comments.
meacer
2016/10/10 19:44:00
Okay, sounds good. I guess without it the test wou
| |
| 265 | |
| 266 // Enter browser fullscreen mode. | |
| 267 FullscreenController* controller = | |
| 268 browser()->exclusive_access_manager()->fullscreen_controller(); | |
| 269 controller->ToggleBrowserFullscreenMode(); | |
| 270 | |
| 271 RunTest("runTest"); | |
| 272 | |
| 273 // Ensure extension is not installed. | |
| 274 ExtensionRegistry* registry = ExtensionRegistry::Get(profile()); | |
| 275 EXPECT_FALSE(registry->GenerateInstalledExtensionsSet()->Contains( | |
| 276 "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb")); | |
| 277 } | |
| 278 | |
| 279 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerTest, | |
| 280 BlockInlineInstallFromFullscreenForTab) { | |
| 281 GURL install_url = | |
|
meacer
2016/10/10 17:57:33
nit: const GURL install_url =
Ackerman
2016/10/10 19:35:58
Done.
| |
| 282 GenerateTestServerUrl(kAppDomain, "install_from_fullscreen.html"); | |
| 283 ui_test_utils::NavigateToURL(browser(), install_url); | |
| 284 AutoAcceptInstall(); | |
|
meacer
2016/10/10 17:57:33
Also not needed?
Ackerman
2016/10/10 19:35:58
Same comment as above.
| |
| 285 WebContents* web_contents = | |
| 286 browser()->tab_strip_model()->GetActiveWebContents(); | |
| 287 FullscreenController* controller = | |
| 288 browser()->exclusive_access_manager()->fullscreen_controller(); | |
| 289 | |
| 290 // Enter tab fullscreen mode. | |
| 291 controller->EnterFullscreenModeForTab(web_contents, install_url); | |
| 292 | |
| 293 RunTest("runTest"); | |
| 294 | |
| 295 // Ensure extension is not installed. | |
| 296 ExtensionRegistry* registry = ExtensionRegistry::Get(profile()); | |
| 297 EXPECT_FALSE(registry->GenerateInstalledExtensionsSet()->Contains( | |
| 298 "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb")); | |
| 299 } | |
| 300 | |
| 259 // Ensure that inline-installing a disabled extension simply re-enables it. | 301 // Ensure that inline-installing a disabled extension simply re-enables it. |
| 260 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerTest, | 302 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerTest, |
| 261 ReinstallDisabledExtension) { | 303 ReinstallDisabledExtension) { |
| 262 // Install an extension via inline install, and confirm it is successful. | 304 // Install an extension via inline install, and confirm it is successful. |
| 263 AutoAcceptInstall(); | 305 AutoAcceptInstall(); |
| 264 ui_test_utils::NavigateToURL( | 306 ui_test_utils::NavigateToURL( |
| 265 browser(), GenerateTestServerUrl(kAppDomain, "install.html")); | 307 browser(), GenerateTestServerUrl(kAppDomain, "install.html")); |
| 266 RunTest("runTest"); | 308 RunTest("runTest"); |
| 267 ExtensionRegistry* registry = ExtensionRegistry::Get(profile()); | 309 ExtensionRegistry* registry = ExtensionRegistry::Get(profile()); |
| 268 ASSERT_TRUE(registry->enabled_extensions().GetByID(kTestExtensionId)); | 310 ASSERT_TRUE(registry->enabled_extensions().GetByID(kTestExtensionId)); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 359 browser(), GenerateTestServerUrl(kAppDomain, "both_listeners.html"), | 401 browser(), GenerateTestServerUrl(kAppDomain, "both_listeners.html"), |
| 360 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 402 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 361 DCHECK_NE(old_tab_index, browser()->tab_strip_model()->active_index()); | 403 DCHECK_NE(old_tab_index, browser()->tab_strip_model()->active_index()); |
| 362 browser()->tab_strip_model()->CloseWebContentsAt(old_tab_index, | 404 browser()->tab_strip_model()->CloseWebContentsAt(old_tab_index, |
| 363 TabStripModel::CLOSE_NONE); | 405 TabStripModel::CLOSE_NONE); |
| 364 WebstoreInstallerTest::RunTest("runTest"); | 406 WebstoreInstallerTest::RunTest("runTest"); |
| 365 EXPECT_TRUE(registry->enabled_extensions().GetByID(kTestExtensionId)); | 407 EXPECT_TRUE(registry->enabled_extensions().GetByID(kTestExtensionId)); |
| 366 } | 408 } |
| 367 | 409 |
| 368 } // namespace extensions | 410 } // namespace extensions |
| OLD | NEW |