chromium/chrome/browser/apps/platform_apps/app_window_browsertest.cc

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/apps/app_service/app_launch_params.h"
#include "chrome/browser/apps/app_service/app_service_proxy.h"
#include "chrome/browser/apps/app_service/app_service_proxy_factory.h"
#include "chrome/browser/apps/app_service/browser_app_launcher.h"
#include "chrome/browser/apps/platform_apps/app_browsertest_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "components/services/app_service/public/cpp/app_launch_util.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/test_utils.h"
#include "extensions/browser/app_window/app_window_geometry_cache.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_id.h"
#include "extensions/test/extension_test_message_listener.h"
#include "extensions/test/result_catcher.h"
#include "ui/display/display_switches.h"

AppWindowGeometryCache;
ResultCatcher;

// This helper class can be used to wait for changes in the app window
// geometry cache registry for a specific window in a specific extension.
class GeometryCacheChangeHelper : AppWindowGeometryCache::Observer {};

// Helper class for tests related to the Apps Window API (chrome.app.window).
class AppWindowAPITest : public extensions::PlatformAppBrowserTest {};

// These tests are flaky after https://codereview.chromium.org/57433010/.
// See http://crbug.com/319613.

IN_PROC_BROWSER_TEST_F(AppWindowAPITest, TestCreate) {}

IN_PROC_BROWSER_TEST_F(AppWindowAPITest, TestSingleton) {}

IN_PROC_BROWSER_TEST_F(AppWindowAPITest, TestCloseEvent) {}

IN_PROC_BROWSER_TEST_F(AppWindowAPITest, DISABLED_TestMaximize) {}

// Flaky on Linux. http://crbug.com/424399.
// TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
// of lacros-chrome is complete.
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
#define MAYBE_TestMinimize
#else
#define MAYBE_TestMinimize
#endif

IN_PROC_BROWSER_TEST_F(AppWindowAPITest, MAYBE_TestMinimize) {}

IN_PROC_BROWSER_TEST_F(AppWindowAPITest, DISABLED_TestRestore) {}

IN_PROC_BROWSER_TEST_F(AppWindowAPITest, DISABLED_TestRestoreAfterClose) {}

// These tests will be flaky in Linux as window bounds change asynchronously.
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
#define MAYBE_TestDeprecatedBounds
#define MAYBE_TestInitialBounds
#define MAYBE_TestInitialConstraints
#define MAYBE_TestSetBounds
#define MAYBE_TestSetSizeConstraints
#else
#define MAYBE_TestDeprecatedBounds
#define MAYBE_TestInitialBounds
#define MAYBE_TestInitialConstraints
#define MAYBE_TestSetBounds
// Disabled as flakey, see http://crbug.com/434532 for details.
#define MAYBE_TestSetSizeConstraints
#endif

IN_PROC_BROWSER_TEST_F(AppWindowAPITest, MAYBE_TestDeprecatedBounds) {}

IN_PROC_BROWSER_TEST_F(AppWindowAPITest, MAYBE_TestInitialBounds) {}

IN_PROC_BROWSER_TEST_F(AppWindowAPITest, MAYBE_TestInitialConstraints) {}

IN_PROC_BROWSER_TEST_F(AppWindowAPITest, MAYBE_TestSetBounds) {}

IN_PROC_BROWSER_TEST_F(AppWindowAPITest, MAYBE_TestSetSizeConstraints) {}

// Flaky failures on mac_rel and WinXP, see http://crbug.com/324915.
IN_PROC_BROWSER_TEST_F(AppWindowAPITest,
                       DISABLED_TestRestoreGeometryCacheChange) {}

// TODO(benwells): Implement on Mac.
#if defined(USE_AURA)
IN_PROC_BROWSER_TEST_F(AppWindowAPITest, TestFrameColors) {}
#endif

IN_PROC_BROWSER_TEST_F(AppWindowAPITest, TestVisibleOnAllWorkspaces) {}