chromium/chrome/test/base/in_process_browser_test_browsertest.cc

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

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "chrome/test/base/in_process_browser_test.h"

#include <stddef.h>
#include <string.h>

#include "base/files/file_util.h"
#include "base/path_service.h"
#include "build/build_config.h"
#include "chrome/browser/after_startup_task_utils.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test.h"
#include "net/base/filename_util.h"
#include "net/base/net_errors.h"
#include "net/dns/public/resolve_error_info.h"
#include "testing/gtest/include/gtest/gtest.h"

#if defined(TOOLKIT_VIEWS)
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/toolbar/browser_app_menu_button.h"
#include "chrome/browser/ui/views/toolbar/toolbar_view.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/views/bubble/bubble_dialog_delegate_view.h"
#include "ui/views/view.h"
#endif

namespace {

class InProcessBrowserTestP
    : public InProcessBrowserTest,
      public ::testing::WithParamInterface<const char*> {};

IN_PROC_BROWSER_TEST_P(InProcessBrowserTestP, TestP) {}

INSTANTIATE_TEST_SUITE_P();

// WebContents observer that can detect provisional load failures.
class LoadFailObserver : public content::WebContentsObserver {};

// Tests that InProcessBrowserTest cannot resolve external host, in this case
// "google.com" and "cnn.com". Using external resources is disabled by default
// in InProcessBrowserTest because it causes flakiness.
IN_PROC_BROWSER_TEST_F(InProcessBrowserTest, ExternalConnectionFail) {}

// Verify that AfterStartupTaskUtils considers startup to be complete
// prior to test execution so tasks posted by tests are never deferred.
IN_PROC_BROWSER_TEST_F(InProcessBrowserTest, AfterStartupTaskUtils) {}

// On Mac this crashes inside cc::SingleThreadProxy::SetNeedsCommit. See
// https://ci.chromium.org/b/8923336499994443392
#if !BUILDFLAG(IS_MAC)
class SingleProcessBrowserTest : public InProcessBrowserTest {};

// TODO(crbug.com/40190525): Flaky / times out on many bots.
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
#define MAYBE_Test
#else
#define MAYBE_Test
#endif
IN_PROC_BROWSER_TEST_F(SingleProcessBrowserTest, MAYBE_Test) {}

#endif

#if defined(TOOLKIT_VIEWS)

namespace {

class LayoutTrackingView : public views::View {};

BEGIN_METADATA()

}  // namespace

IN_PROC_BROWSER_TEST_F(InProcessBrowserTest,
                       RunsScheduledLayoutOnAnchoredBubbles) {}

#endif  // defined(TOOLKIT_VIEWS)

}  // namespace