chromium/chrome/browser/ui/views/bookmarks/bookmark_bubble_view_unittest.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 "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h"

#include <memory>
#include <string>
#include <utility>

#include "base/functional/bind.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#include "chrome/browser/commerce/shopping_service_factory.h"
#include "chrome/browser/feature_engagement/tracker_factory.h"
#include "chrome/browser/signin/chrome_signin_client_factory.h"
#include "chrome/browser/signin/chrome_signin_client_test_util.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/signin/identity_test_environment_profile_adaptor.h"
#include "chrome/browser/sync/sync_service_factory.h"
#include "chrome/browser/ui/browser_element_identifiers.h"
#include "chrome/browser/ui/commerce/mock_commerce_ui_tab_helper.h"
#include "chrome/browser/ui/signin/bubble_signin_promo_delegate.h"
#include "chrome/browser/ui/tabs/public/tab_features.h"
#include "chrome/browser/ui/tabs/public/tab_interface.h"
#include "chrome/browser/ui/views/commerce/price_tracking_view.h"
#include "chrome/browser/ui/views/commerce/shopping_collection_iph_view.h"
#include "chrome/test/base/browser_with_test_window_test.h"
#include "chrome/test/views/chrome_test_widget.h"
#include "components/bookmarks/browser/bookmark_utils.h"
#include "components/bookmarks/test/bookmark_test_helpers.h"
#include "components/commerce/core/commerce_feature_list.h"
#include "components/commerce/core/mock_shopping_service.h"
#include "components/commerce/core/price_tracking_utils.h"
#include "components/commerce/core/test_utils.h"
#include "components/feature_engagement/public/feature_constants.h"
#include "components/feature_engagement/test/mock_tracker.h"
#include "components/signin/public/identity_manager/identity_test_utils.h"
#include "components/sync/test/test_sync_service.h"
#include "components/ukm/test_ukm_recorder.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "ui/base/interaction/element_identifier.h"
#include "ui/base/interaction/element_tracker.h"
#include "ui/views/bubble/bubble_dialog_delegate_view.h"
#include "ui/views/interaction/element_tracker_views.h"
#include "ui/views/test/widget_test.h"
#include "ui/views/widget/unique_widget_ptr.h"
BookmarkModel;

namespace {
const char kTestBookmarkURL[] =;
} // namespace

class BookmarkBubbleViewTestBase : public BrowserWithTestWindowTest {};

class BookmarkBubbleViewTest : public BookmarkBubbleViewTestBase {};

// Verifies that the sync promo is not displayed for a signed in user.
TEST_F(BookmarkBubbleViewTest, SyncPromoSignedIn) {}

// Verifies that the sync promo is displayed for a user that is not signed in.
TEST_F(BookmarkBubbleViewTest, SyncPromoNotSignedIn) {}

// Verifies that the price tracking view is displayed for trackable product.
TEST_F(BookmarkBubbleViewTest, PriceTrackingViewIsVisible) {}

TEST_F(BookmarkBubbleViewTest, RecordPriceTrackingUkmForNewBookmark) {}

TEST_F(BookmarkBubbleViewTest, PriceTrackingViewIsHidden) {}

// Verifies that the price tracking view is displayed with the correct toggle
// state
TEST_F(BookmarkBubbleViewTest, PriceTrackingViewWithToggleOn) {}

class PriceTrackingViewFeatureFlagTest
    : public BookmarkBubbleViewTestBase,
      public testing::WithParamInterface<bool> {};

INSTANTIATE_TEST_SUITE_P();

TEST_P(PriceTrackingViewFeatureFlagTest, PriceTrackingViewCreation) {}

class BookmarkBubbleViewShoppingCollectionTest
    : public BookmarkBubbleViewTestBase {};

TEST_F(BookmarkBubbleViewShoppingCollectionTest, IPHShown) {}

TEST_F(BookmarkBubbleViewShoppingCollectionTest, IPHNotShown_NotInCollection) {}

TEST_F(BookmarkBubbleViewShoppingCollectionTest, IPHNotShown_NotAProduct) {}