Commit ad09d070 authored by Sebastien Marchand's avatar Sebastien Marchand Committed by Commit Bot

Fix a flakiness in the TabLifeCycleUnit tests

The bug causing
TabLifecycleUnitTest.CannotFreezeOrDiscardIfConnectedToBluetooth was due to
the test running right before it, which was modifying a global state
without resetting it to the proper value.

Bug: 1004578
Change-Id: I0c8fa306e0d2f40911c18de52c062352d380fb5f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1808335
Commit-Queue: Sébastien Marchand <sebmarchand@chromium.org>
Auto-Submit: Sébastien Marchand <sebmarchand@chromium.org>
Reviewed-by: default avatarFrançois Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697699}
parent 84e936a7
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include "base/auto_reset.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/observer_list.h" #include "base/observer_list.h"
...@@ -888,8 +889,10 @@ TEST_F(TabLifecycleUnitTest, DisableHeuristicsFlag) { ...@@ -888,8 +889,10 @@ TEST_F(TabLifecycleUnitTest, DisableHeuristicsFlag) {
decision_details.Clear(); decision_details.Clear();
// Disable the heuristics and check that the tab can now be safely discarded. // Disable the heuristics and check that the tab can now be safely discarded.
GetMutableStaticProactiveTabFreezeAndDiscardParamsForTesting() base::AutoReset<bool> disable_heuristics_protections(
->disable_heuristics_protections = true; &GetMutableStaticProactiveTabFreezeAndDiscardParamsForTesting()
->disable_heuristics_protections,
true);
EXPECT_TRUE(tab_lifecycle_unit.CanFreeze(&decision_details)); EXPECT_TRUE(tab_lifecycle_unit.CanFreeze(&decision_details));
EXPECT_TRUE(decision_details.IsPositive()); EXPECT_TRUE(decision_details.IsPositive());
...@@ -901,9 +904,7 @@ TEST_F(TabLifecycleUnitTest, DisableHeuristicsFlag) { ...@@ -901,9 +904,7 @@ TEST_F(TabLifecycleUnitTest, DisableHeuristicsFlag) {
decision_details.Clear(); decision_details.Clear();
} }
// TODO(crbug.com/1004578) Disabled due to flake TEST_F(TabLifecycleUnitTest, CannotFreezeOrDiscardIfConnectedToBluetooth) {
TEST_F(TabLifecycleUnitTest,
DISABLED_CannotFreezeOrDiscardIfConnectedToBluetooth) {
TabLifecycleUnit tab_lifecycle_unit(GetTabLifecycleUnitSource(), &observers_, TabLifecycleUnit tab_lifecycle_unit(GetTabLifecycleUnitSource(), &observers_,
usage_clock_.get(), web_contents_, usage_clock_.get(), web_contents_,
tab_strip_model_.get()); tab_strip_model_.get());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment