#include "chrome/browser/ui/views/performance_controls/memory_saver_bubble_view.h"
#include <tuple>
#include "base/test/metrics/histogram_tester.h"
#include "base/time/time.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/resource_coordinator/lifecycle_unit_state.mojom-shared.h"
#include "chrome/browser/ui/browser_element_identifiers.h"
#include "chrome/browser/ui/performance_controls/performance_controls_metrics.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/frame/test_with_browser_view.h"
#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
#include "chrome/browser/ui/views/page_action/page_action_icon_controller.h"
#include "chrome/browser/ui/views/page_action/page_action_icon_view.h"
#include "chrome/browser/ui/views/performance_controls/memory_saver_chip_view.h"
#include "chrome/browser/ui/views/performance_controls/memory_saver_resource_view.h"
#include "chrome/browser/ui/views/performance_controls/test_support/memory_saver_unit_test_mixin.h"
#include "chrome/grit/branded_strings.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/test/base/testing_profile.h"
#include "components/performance_manager/public/features.h"
#include "components/performance_manager/public/user_tuning/prefs.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/testing_pref_service.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/mock_navigation_handle.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/interaction/element_identifier.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/text/bytes_formatting.h"
#include "ui/events/event_utils.h"
#include "ui/events/types/event_type.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/controls/label.h"
#include "ui/views/interaction/element_tracker_views.h"
#include "ui/views/test/button_test_api.h"
#include "ui/views/widget/widget.h"
namespace {
constexpr int kMemorySavingsKilobytes = …;
}
class MemorySaverBubbleViewTest
: public MemorySaverUnitTestMixin<TestWithBrowserView>,
public testing::WithParamInterface<std::tuple<int, int>> { … };
TEST_F(MemorySaverBubbleViewTest, ShouldOpenDialogOnClick) { … }
TEST_F(MemorySaverBubbleViewTest, ShouldLogMetricsOnDialogDismiss) { … }
TEST_F(MemorySaverBubbleViewTest, ShouldRenderDomainInDialogSubtitle) { … }
TEST_F(MemorySaverBubbleViewTest,
ShowDialogWithoutExcludeSiteButtonInGuestMode) { … }
TEST_F(MemorySaverBubbleViewTest,
ShouldCollapseChipAfterNavigatingTabsWithDialogOpen) { … }
TEST_F(MemorySaverBubbleViewTest, ShouldRenderMemorySavingsInResourceView) { … }
TEST_F(MemorySaverBubbleViewTest,
ShouldNotRenderMemorySavingsInDialogBodyText) { … }
TEST_P(MemorySaverBubbleViewTest, ShowsCorrectLabelsForDifferentSavings) { … }
INSTANTIATE_TEST_SUITE_P(…);