Commit ed19b892 authored by Eric Willigers's avatar Eric Willigers Committed by Commit Bot

Desktop PWAs: Port various PWA mixed content tests with BMO

The HostedAppPWAOnlyTestWithAutoupgradesDisabled tests
have been moved to
PWAMixedContentBrowserTestWithAutoupgradesDisabled
as they no longer depended on the extensions-based
implementation.

Note that the HostedAppTestWithAutoupgradesDisabled and
HostedAppPWAOnlyTestWithAutoupgradesDisabled tests in
hosted_app_browsertest.cc have not been run recently, as
there was no INSTANTIATE_TEST_SUITE_P entry for these tests.

Some mixed content now loads with warnings (due to security
changes that occurred while the tests were not enabled).

Previously landed as https://chromium-review.googlesource.com/c/chromium/src/+/2049407
and reverted due to linux-chromeos-chrome failures.

Bug: 1026808
Change-Id: I4328328da72001d9005abe3792d8a30e02d684b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2054604
Commit-Queue: Eric Willigers <ericwilligers@chromium.org>
Commit-Queue: Alan Cutter <alancutter@chromium.org>
Auto-Submit: Eric Willigers <ericwilligers@chromium.org>
Reviewed-by: default avatarAlan Cutter <alancutter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#741281}
parent 1a9ebd2f
......@@ -16,6 +16,7 @@
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/page_info/page_info_dialog.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/toolbar/app_menu_model.h"
#include "chrome/browser/ui/web_applications/app_browser_controller.h"
......@@ -32,6 +33,7 @@
#include "chrome/common/web_application_info.h"
#include "components/sessions/core/tab_restore_service.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_utils.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/clipboard/clipboard.h"
#include "ui/base/clipboard/clipboard_buffer.h"
......@@ -144,6 +146,57 @@ IN_PROC_BROWSER_TEST_P(WebAppBrowserTest, AutoGeneratedUserThemeCrash) {
LaunchWebAppBrowser(app_id);
}
// Check the 'Open in Chrome' menu button for web app windows.
IN_PROC_BROWSER_TEST_P(WebAppBrowserTest, OpenInChrome) {
const GURL app_url(kExampleURL);
const AppId app_id = InstallPWA(app_url);
{
Browser* const app_browser = LaunchWebAppBrowser(app_id);
EXPECT_EQ(1, app_browser->tab_strip_model()->count());
EXPECT_EQ(1, browser()->tab_strip_model()->count());
ASSERT_EQ(2u, chrome::GetBrowserCount(browser()->profile()));
chrome::ExecuteCommand(app_browser, IDC_OPEN_IN_CHROME);
// The browser frame is closed next event loop so it's still safe to access
// here.
EXPECT_EQ(0, app_browser->tab_strip_model()->count());
EXPECT_EQ(2, browser()->tab_strip_model()->count());
EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
EXPECT_EQ(
app_url,
browser()->tab_strip_model()->GetActiveWebContents()->GetVisibleURL());
}
// Wait until the browser actually gets closed. This invalidates
// |app_browser|.
content::RunAllPendingInMessageLoop();
ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile()));
}
// Check the 'App info' menu button for web app windows.
IN_PROC_BROWSER_TEST_P(WebAppBrowserTest, AppInfoOpensPageInfo) {
const GURL app_url(kExampleURL);
const AppId app_id = InstallPWA(app_url);
Browser* const app_browser = LaunchWebAppBrowser(app_id);
bool dialog_created = false;
GetPageInfoDialogCreatedCallbackForTesting() = base::BindOnce(
[](bool* dialog_created) { *dialog_created = true; }, &dialog_created);
chrome::ExecuteCommand(app_browser, IDC_WEB_APP_MENU_APP_INFO);
EXPECT_TRUE(dialog_created);
// The test closure should have run. But clear the global in case it hasn't.
EXPECT_FALSE(GetPageInfoDialogCreatedCallbackForTesting());
GetPageInfoDialogCreatedCallbackForTesting().Reset();
}
IN_PROC_BROWSER_TEST_P(WebAppBrowserTest, HasMinimalUiButtons) {
int index = 0;
auto has_buttons = [this, &index](DisplayMode display_mode,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment