Commit ec6609f0 authored by Sylvain Defresne's avatar Sylvain Defresne Committed by Commit Bot

Fix flaky tests ProgrammaticTabModelTest/TabModelTest.*

The tests ProgrammaticTabModelTest/TabModelTest.* tried to
clean up the session file using NSFileManager but this step
was flaky due to a race condition (it sometimes fails with
a permission error).

TestChromeBrowserState already delete the state directory
if no explicit path is passed to the builder, thus the step
to clean up was unnecessary and can be removed.

Bug: none
Change-Id: If0ece62ee5cee726e4135952f3d50efae35dabb6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1865211
Auto-Submit: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarStepan Khapugin <stkhapugin@chromium.org>
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#706450}
parent 0df4474a
......@@ -666,14 +666,9 @@ TEST_P(TabModelTest, RestorePersistedSessionAfterEmpty) {
[tab_model_ restoreSessionWindow:session_window forInitialRestore:NO];
EXPECT_EQ(0U, [tab_model_ count]);
EXPECT_TRUE([[NSFileManager defaultManager] removeItemAtPath:state_path
error:nullptr]);
}
TEST_P(TabModelTest, DISABLED_PersistSelectionChange) {
NSString* stashPath =
base::SysUTF8ToNSString(chrome_browser_state_->GetStatePath().value());
// Reset the TabModel with a custom SessionServiceIOS (to control whether
// data is saved to disk).
TestSessionService* test_session_service = [[TestSessionService alloc] init];
......@@ -723,10 +718,6 @@ TEST_P(TabModelTest, DISABLED_PersistSelectionChange) {
EXPECT_EQ(tab_model_.webStateList->GetWebStateAt(1),
tab_model_.webStateList->GetActiveWebState());
// Clean up.
EXPECT_TRUE([[NSFileManager defaultManager] removeItemAtPath:stashPath
error:nullptr]);
}
INSTANTIATE_TEST_SUITE_P(ProgrammaticTabModelTest,
......
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