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

Side by Side Diff: chrome/utility/image_writer/image_writer_unittest.cc

Issue 2797293002: Use ScopedTaskEnvironment instead of MessageLoop in chrome unit tests. (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « chrome/browser/ui/desktop_ios_promotion/sms_service_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stdint.h> 5 #include <stdint.h>
6 #include <string.h> 6 #include <string.h>
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
11 #include "base/files/scoped_temp_dir.h" 11 #include "base/files/scoped_temp_dir.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "base/test/scoped_task_environment.h"
13 #include "chrome/utility/image_writer/error_messages.h" 14 #include "chrome/utility/image_writer/error_messages.h"
14 #include "chrome/utility/image_writer/image_writer.h" 15 #include "chrome/utility/image_writer/image_writer.h"
15 #include "chrome/utility/image_writer/image_writer_handler.h" 16 #include "chrome/utility/image_writer/image_writer_handler.h"
16 #include "testing/gmock/include/gmock/gmock.h" 17 #include "testing/gmock/include/gmock/gmock.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 19
19 namespace image_writer { 20 namespace image_writer {
20 21
21 using testing::_; 22 using testing::_;
22 using testing::AnyNumber; 23 using testing::AnyNumber;
(...skipping 23 matching lines...) Expand all
46 47
47 ASSERT_TRUE(base::WriteFile(path, buffer.get(), kTestFileSize)); 48 ASSERT_TRUE(base::WriteFile(path, buffer.get(), kTestFileSize));
48 } 49 }
49 50
50 void FillDefault(const base::FilePath& path) { FillFile(path, kTestPattern); } 51 void FillDefault(const base::FilePath& path) { FillFile(path, kTestPattern); }
51 52
52 base::FilePath image_path_; 53 base::FilePath image_path_;
53 base::FilePath device_path_; 54 base::FilePath device_path_;
54 55
55 private: 56 private:
56 base::MessageLoop message_loop_; 57 base::test::ScopedTaskEnvironment scoped_task_environment_;
57 base::ScopedTempDir temp_dir_; 58 base::ScopedTempDir temp_dir_;
58 }; 59 };
59 60
60 class MockHandler : public ImageWriterHandler { 61 class MockHandler : public ImageWriterHandler {
61 public: 62 public:
62 MOCK_METHOD1(SendProgress, void(int64_t)); 63 MOCK_METHOD1(SendProgress, void(int64_t));
63 MOCK_METHOD1(SendFailed, void(const std::string& message)); 64 MOCK_METHOD1(SendFailed, void(const std::string& message));
64 MOCK_METHOD0(SendSucceeded, void()); 65 MOCK_METHOD0(SendSucceeded, void());
65 }; 66 };
66 67
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 EXPECT_CALL(mock_handler, SendFailed(_)).Times(0); 225 EXPECT_CALL(mock_handler, SendFailed(_)).Times(0);
225 226
226 FillDefault(image_path_); 227 FillDefault(image_path_);
227 228
228 image_writer.Write(); 229 image_writer.Write();
229 230
230 base::RunLoop().RunUntilIdle(); 231 base::RunLoop().RunUntilIdle();
231 } 232 }
232 233
233 } // namespace image_writer 234 } // namespace image_writer
OLDNEW
« no previous file with comments | « chrome/browser/ui/desktop_ios_promotion/sms_service_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698