Commit db367b20 authored by Olivier Robin's avatar Olivier Robin Committed by Chromium LUCI CQ

Fix SceneState flaky test.

incognitoContentVisible is persisted in NSUserDefaults in some
configurations.
This means that unittests must not assume any initial value and
the value to false (default) if possible.

Change-Id: I4331afe28a60ba1e592d33ca4505af890cb22dc7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2627853
Auto-Submit: Olivier Robin <olivierrobin@chromium.org>
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843471}
parent 76eefae8
......@@ -86,6 +86,12 @@ class IncognitoUsageAppStateAgentTest : public PlatformTest {
sceneConnected:mock_scene_state2_];
}
void TearDown() override {
SetScene1DisplaysIncognito(NO);
SetScene2DisplaysIncognito(NO);
PlatformTest::TearDown();
}
base::HistogramTester histogram_tester_;
base::ScopedMockClockOverride scoped_clock_;
IncognitoUsageAppStateAgent* incognito_agent_;
......
......@@ -27,6 +27,10 @@ class IncognitoBlockerSceneAgentTest : public PlatformTest {
agent_.sceneState = scene_state_;
}
~IncognitoBlockerSceneAgentTest() override {
scene_state_.incognitoContentVisible = NO;
}
protected:
// The scene state that the agent works with.
SceneState* scene_state_;
......
......@@ -32,6 +32,7 @@ class SceneControllerTest : public PlatformTest {
// Tests that scene controller updates scene state's incognitoContentVisible
// when the relevant application command is called.
TEST_F(SceneControllerTest, UpdatesIncognitoContentVisibility) {
[scene_controller_ setIncognitoContentVisible:NO];
EXPECT_FALSE(scene_state_.incognitoContentVisible);
[scene_controller_ setIncognitoContentVisible:YES];
EXPECT_TRUE(scene_state_.incognitoContentVisible);
......
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