#include "base/callback_list.h"
#include "base/strings/string_number_conversions.h"
#include "base/test/bind.h"
#include "base/test/simple_test_tick_clock.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/performance_manager/public/user_tuning/user_performance_tuning_manager.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/resource_coordinator/tab_lifecycle_unit.h"
#include "chrome/browser/resource_coordinator/tab_manager.h"
#include "chrome/browser/resource_coordinator/utils.h"
#include "chrome/browser/ui/browser_element_identifiers.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/performance_controls/test_support/memory_saver_interactive_test_mixin.h"
#include "chrome/browser/ui/recently_audible_helper.h"
#include "chrome/browser/ui/views/frame/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/performance_controls/memory_saver_bubble_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/tabs/tab_icon.h"
#include "chrome/browser/ui/views/tabs/tab_strip.h"
#include "chrome/browser/ui/webui/test_support/webui_interactive_test_mixin.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/interaction/interactive_browser_test.h"
#include "chrome/test/user_education/interactive_feature_promo_test.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/content_settings/core/common/content_settings.h"
#include "components/content_settings/core/common/content_settings_types.h"
#include "components/feature_engagement/public/feature_constants.h"
#include "components/feature_engagement/public/feature_list.h"
#include "components/feature_engagement/test/scoped_iph_feature_list.h"
#include "components/performance_manager/public/decorators/process_metrics_decorator.h"
#include "components/performance_manager/public/features.h"
#include "components/performance_manager/public/performance_manager.h"
#include "components/performance_manager/public/user_tuning/prefs.h"
#include "components/prefs/pref_service.h"
#include "components/user_education/views/help_bubble_view.h"
#include "content/public/test/browser_test.h"
#include "net/dns/mock_host_resolver.h"
#include "third_party/blink/public/common/switches.h"
#include "ui/base/interaction/element_identifier.h"
#include "ui/base/interaction/element_tracker.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/text/bytes_formatting.h"
#include "ui/gfx/animation/animation.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/controls/button/label_button.h"
#include "ui/views/controls/styled_label.h"
#include "ui/views/interaction/element_tracker_views.h"
#include "url/gurl.h"
namespace {
DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE(…);
DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE(…);
DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE(…);
DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE(…);
DEFINE_LOCAL_CUSTOM_ELEMENT_EVENT_TYPE(…);
constexpr char kSkipPixelTestsReason[] = …;
}
class MemorySaverDiscardPolicyInteractiveTest
: public MemorySaverInteractiveTestMixin<InteractiveBrowserTest> { … };
IN_PROC_BROWSER_TEST_F(MemorySaverDiscardPolicyInteractiveTest,
TabWithVideoNotDiscarded) { … }
IN_PROC_BROWSER_TEST_F(MemorySaverDiscardPolicyInteractiveTest,
TabWithAudioNotDiscarded) { … }
IN_PROC_BROWSER_TEST_F(MemorySaverDiscardPolicyInteractiveTest,
TabWithFormNotDiscarded) { … }
IN_PROC_BROWSER_TEST_F(MemorySaverDiscardPolicyInteractiveTest,
TabWithNotificationNotDiscarded) { … }
class MemorySaverChipInteractiveTest
: public MemorySaverInteractiveTestMixin<InteractiveBrowserTest> { … };
IN_PROC_BROWSER_TEST_F(MemorySaverChipInteractiveTest, PageActionChipShows) { … }
IN_PROC_BROWSER_TEST_F(MemorySaverChipInteractiveTest,
PageActionChipCollapseOnTabSwitch) { … }
IN_PROC_BROWSER_TEST_F(MemorySaverChipInteractiveTest,
ChipCollapseRemainCollapse) { … }
IN_PROC_BROWSER_TEST_F(MemorySaverChipInteractiveTest,
ChipShowsOnNonChromeSites) { … }
IN_PROC_BROWSER_TEST_F(MemorySaverChipInteractiveTest,
CloseBubbleOnOkButtonClick) { … }
IN_PROC_BROWSER_TEST_F(MemorySaverChipInteractiveTest,
CloseBubbleOnCloseButtonClick) { … }
IN_PROC_BROWSER_TEST_F(MemorySaverChipInteractiveTest, CloseBubbleOnChipClick) { … }
IN_PROC_BROWSER_TEST_F(MemorySaverChipInteractiveTest, CloseBubbleOnTabSwitch) { … }
IN_PROC_BROWSER_TEST_F(MemorySaverChipInteractiveTest,
BubbleCorrectlyReportingMemorySaved) { … }
IN_PROC_BROWSER_TEST_F(MemorySaverChipInteractiveTest,
ModifyExceptionsListOnCancelButtonClick) { … }
IN_PROC_BROWSER_TEST_F(MemorySaverChipInteractiveTest,
CancelButtonStatePreseveredWhenSwitchingTabs) { … }
IN_PROC_BROWSER_TEST_F(MemorySaverChipInteractiveTest,
RenderVisualizationInDialog) { … }
class MemorySaverDiscardIndicatorIPHTest
: public MemorySaverInteractiveTestMixin<InteractiveFeaturePromoTest> { … };
IN_PROC_BROWSER_TEST_F(MemorySaverDiscardIndicatorIPHTest,
IPHAppearsWhenTabIsDiscarded) { … }
class MemorySaverImprovedFaviconTreatmentTest
: public WebUiInteractiveTestMixin<
MemorySaverInteractiveTestMixin<InteractiveBrowserTest>> { … };
IN_PROC_BROWSER_TEST_F(MemorySaverImprovedFaviconTreatmentTest,
FaviconTreatmentOnDiscard) { … }
IN_PROC_BROWSER_TEST_F(MemorySaverImprovedFaviconTreatmentTest,
DiscardRingTreatmentSetting) { … }