chromium/extensions/browser/app_window/app_window_browsertest.cc

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

#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/apps/platform_apps/app_browsertest_util.h"
#include "chrome/browser/profiles/profile.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "extensions/browser/app_window/native_app_window.h"
#include "third_party/skia/include/core/SkRegion.h"

namespace extensions {

namespace {

AppWindowBrowserTest;

// This test is disabled on Linux because of the unpredictable nature of native
// windows. We cannot assume that the window manager will insert any title bar
// at all, so the test may fail on certain window managers.
// 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_FrameInsetsForDefaultFrame
#else
#define MAYBE_FrameInsetsForDefaultFrame
#endif

// Verifies that the NativeAppWindows implement GetFrameInsets() correctly.
// See http://crbug.com/346115
IN_PROC_BROWSER_TEST_F(AppWindowBrowserTest, MAYBE_FrameInsetsForDefaultFrame) {}

// Verifies that the NativeAppWindows implement GetFrameInsets() correctly.
// See http://crbug.com/346115
IN_PROC_BROWSER_TEST_F(AppWindowBrowserTest, FrameInsetsForColoredFrame) {}

// Verifies that the NativeAppWindows implement GetFrameInsets() correctly for
// frameless windows.
IN_PROC_BROWSER_TEST_F(AppWindowBrowserTest, FrameInsetsForNoFrame) {}

IN_PROC_BROWSER_TEST_F(AppWindowBrowserTest, IncognitoOpenUrl) {}

IN_PROC_BROWSER_TEST_F(AppWindowBrowserTest, DraggableFramelessWindow) {}

#if BUILDFLAG(IS_CHROMEOS_ASH)

// Disabled due to flake. https://crbug.com/1416579
IN_PROC_BROWSER_TEST_F(AppWindowBrowserTest,
                       DISABLED_ShouldShowStaleContentOnEviction) {
  AppWindow* app_window = CreateTestAppWindow("{}");
  // Make sure that a surface gets embedded in the frame evictor of the
  // DelegateFrameHost.
  app_window->Show(AppWindow::SHOW_ACTIVE);
  ASSERT_TRUE(app_window->web_contents());
  content::WaitForResizeComplete(app_window->web_contents());

  // Make sure the renderer submits at least one frame before we test frame
  // eviction.
  content::RenderFrameSubmissionObserver submission_observer(
      app_window->web_contents());
  if (!submission_observer.render_frame_count()) {
    submission_observer.WaitForAnyFrameSubmission();
  }

  // Helper function as this test requires inspecting a number of content::
  // internal objects.
  content::VerifyStaleContentOnFrameEviction(
      app_window->web_contents()->GetRenderWidgetHostView());
}

#endif  // BUILDFLAG(IS_CHROMEOS_ASH)

}  // namespace

}  // namespace extensions