Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: chrome/browser/chromeos/base/file_flusher_unittest.cc

Issue 2342813003: Fix flaky FileFlusherTest.DuplicateRequests (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/base/file_flusher.h" 5 #include "chrome/browser/chromeos/base/file_flusher.h"
6 6
7 #include <map> 7 #include <map>
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 EXPECT_EQ(0, GetFlushCount("dir1/file1")); 129 EXPECT_EQ(0, GetFlushCount("dir1/file1"));
130 EXPECT_EQ(0, GetFlushCount("dir1/file2")); 130 EXPECT_EQ(0, GetFlushCount("dir1/file2"));
131 EXPECT_EQ(1, GetFlushCount("dir1/file3")); 131 EXPECT_EQ(1, GetFlushCount("dir1/file3"));
132 132
133 EXPECT_EQ(0, GetFlushCount("dir1/Bad file")); 133 EXPECT_EQ(0, GetFlushCount("dir1/Bad file"));
134 } 134 }
135 135
136 TEST_F(FileFlusherTest, DuplicateRequests) { 136 TEST_F(FileFlusherTest, DuplicateRequests) {
137 std::unique_ptr<FileFlusher> flusher(CreateFileFlusher()); 137 std::unique_ptr<FileFlusher> flusher(CreateFileFlusher());
138 base::RunLoop run_loop; 138 base::RunLoop run_loop;
139 flusher->PauseForTest();
139 flusher->RequestFlush(GetTestFilePath("dir1"), std::vector<base::FilePath>(), 140 flusher->RequestFlush(GetTestFilePath("dir1"), std::vector<base::FilePath>(),
140 base::Closure()); 141 base::Closure());
141 flusher->RequestFlush(GetTestFilePath("dir1"), std::vector<base::FilePath>(), 142 flusher->RequestFlush(GetTestFilePath("dir1"), std::vector<base::FilePath>(),
142 run_loop.QuitClosure()); 143 run_loop.QuitClosure());
144 flusher->ResumeForTest();
143 run_loop.Run(); 145 run_loop.Run();
144 146
145 EXPECT_EQ(1, GetFlushCount("dir1/file1")); 147 EXPECT_EQ(1, GetFlushCount("dir1/file1"));
146 EXPECT_EQ(1, GetFlushCount("dir1/file2")); 148 EXPECT_EQ(1, GetFlushCount("dir1/file2"));
147 EXPECT_EQ(1, GetFlushCount("dir1/file3")); 149 EXPECT_EQ(1, GetFlushCount("dir1/file3"));
148 } 150 }
149 151
150 } // namespace chromeos 152 } // namespace chromeos
OLDNEW
« chrome/browser/chromeos/base/file_flusher.cc ('K') | « chrome/browser/chromeos/base/file_flusher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698