chromium/chrome/browser/ui/bookmarks/bookmark_browsertest.cc

// Copyright 2012 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/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/scoped_observation.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/timer/timer.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/bookmarks/bookmark_drag_drop.h"
#include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h"
#include "chrome/browser/ui/bookmarks/bookmark_utils_desktop.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/bookmarks/browser/bookmark_model.h"
#include "components/bookmarks/browser/bookmark_utils.h"
#include "components/bookmarks/browser/url_and_title.h"
#include "components/bookmarks/test/bookmark_test_helpers.h"
#include "components/security_interstitials/content/security_interstitial_tab_helper.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/prerender_test_util.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h"
#include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/base/ui_base_features.h"
#include "ui/gfx/image/image_skia.h"

BookmarkModel;
BookmarkNode;
UrlAndTitle;

namespace {

const char kPersistBookmarkURL[] =;
const char16_t kPersistBookmarkTitle[] =;
const base::Time kPersistLastUsedTime =;

bool IsShowingInterstitial(content::WebContents* tab) {}

}  // namespace

class TestBookmarkTabHelperObserver : public BookmarkTabHelperObserver {};

class BookmarkBrowsertest : public InProcessBrowserTest {};

// Test of bookmark bar toggling, visibility, and animation.
IN_PROC_BROWSER_TEST_F(BookmarkBrowsertest, BookmarkBarVisibleWait) {}

// Verify that bookmarks persist browser restart.
IN_PROC_BROWSER_TEST_F(BookmarkBrowsertest, PRE_Persist) {}

#if BUILDFLAG(IS_WIN)
// TODO(crbug.com/41443454): The test fails on Windows.
#define MAYBE_Persist
#else
#define MAYBE_Persist
#endif

IN_PROC_BROWSER_TEST_F(BookmarkBrowsertest, MAYBE_Persist) {}

#if !BUILDFLAG(IS_CHROMEOS_ASH)  // No multi-profile on ChromeOS.

// Sanity check that bookmarks from different profiles are separate.
IN_PROC_BROWSER_TEST_F(BookmarkBrowsertest, MultiProfile) {}

#endif

// Sanity check that bookmarks from Incognito mode persist Incognito restart.
IN_PROC_BROWSER_TEST_F(BookmarkBrowsertest, IncognitoPersistence) {}

// Regression for crash caused by opening folder as a group in an incognito
// window when the folder contains URLs that cannot be displayed in incognito.
// See discussion starting at crbug.com/1242351#c15
IN_PROC_BROWSER_TEST_F(
    BookmarkBrowsertest,
    OpenFolderAsGroupInIncognitoWhenBookmarksCantOpenInIncognito) {}

IN_PROC_BROWSER_TEST_F(BookmarkBrowsertest, OpenAllBookmarks) {}

IN_PROC_BROWSER_TEST_F(BookmarkBrowsertest,
                       HideStarOnNonbookmarkedInterstitial) {}

// Provides coverage for the Bookmark Manager bookmark drag and drag image
// generation for dragging a single bookmark.
IN_PROC_BROWSER_TEST_F(BookmarkBrowsertest, DragSingleBookmark) {}

// A favicon update during drag shouldn't trigger the drag flow again. The test
// passes if the favicon update does not cause a crash. (see
// https://crbug.com/1364056)
IN_PROC_BROWSER_TEST_F(BookmarkBrowsertest, FaviconChangeDuringBookmarkDrag) {}

// Provides coverage for the Bookmark Manager bookmark drag and drag image
// generation for dragging multiple bookmarks.
IN_PROC_BROWSER_TEST_F(BookmarkBrowsertest, DragMultipleBookmarks) {}

IN_PROC_BROWSER_TEST_F(BookmarkBrowsertest, PRE_EmitUmaForTimeMetrics) {}

IN_PROC_BROWSER_TEST_F(BookmarkBrowsertest, EmitUmaForTimeMetrics) {}

IN_PROC_BROWSER_TEST_F(BookmarkBrowsertest, PRE_EmitUmaForMostRecentlyUsed) {}

IN_PROC_BROWSER_TEST_F(BookmarkBrowsertest, EmitUmaForMostRecentlyUsed) {}

IN_PROC_BROWSER_TEST_F(BookmarkBrowsertest,
                       EmitUmaForMostRecentlyUsed_NoBookmarks) {}

// Test that the bookmark star state updates in response to same document
// navigations that change the URL
IN_PROC_BROWSER_TEST_F(BookmarkBrowsertest, SameDocumentNavigation) {}

IN_PROC_BROWSER_TEST_F(BookmarkBrowsertest,
                       DifferentDocumentNavigationWithoutFinishing) {}

IN_PROC_BROWSER_TEST_F(BookmarkBrowsertest, NonCommitURLNavigation) {}

class BookmarkPrerenderBrowsertest : public BookmarkBrowsertest {};

IN_PROC_BROWSER_TEST_F(BookmarkPrerenderBrowsertest,
                       PrerenderingShouldNotUpdateStarredState) {}