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

Side by Side Diff: content/browser/renderer_host/pepper/quota_reservation_unittest.cc

Issue 2800893002: Use ScopedTaskEnvironment instead of MessageLoop in content 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/browser/renderer_host/pepper/quota_reservation.h" 5 #include "content/browser/renderer_host/pepper/quota_reservation.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/files/file.h" 13 #include "base/files/file.h"
14 #include "base/files/file_util.h" 14 #include "base/files/file_util.h"
15 #include "base/files/scoped_temp_dir.h" 15 #include "base/files/scoped_temp_dir.h"
16 #include "base/location.h" 16 #include "base/location.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/run_loop.h" 18 #include "base/run_loop.h"
19 #include "base/single_thread_task_runner.h" 19 #include "base/single_thread_task_runner.h"
20 #include "base/test/scoped_task_environment.h"
20 #include "base/threading/thread_task_runner_handle.h" 21 #include "base/threading/thread_task_runner_handle.h"
21 #include "storage/browser/fileapi/quota/quota_reservation.h" 22 #include "storage/browser/fileapi/quota/quota_reservation.h"
22 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
23 24
24 using storage::QuotaReservationManager; 25 using storage::QuotaReservationManager;
25 26
26 namespace content { 27 namespace content {
27 28
28 namespace { 29 namespace {
29 30
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 base::File::FLAG_OPEN_ALWAYS | base::File::FLAG_WRITE); 114 base::File::FLAG_OPEN_ALWAYS | base::File::FLAG_WRITE);
114 ASSERT_TRUE(file.IsValid()); 115 ASSERT_TRUE(file.IsValid());
115 ASSERT_TRUE(file.SetLength(size)); 116 ASSERT_TRUE(file.SetLength(size));
116 } 117 }
117 118
118 QuotaReservationManager* reservation_manager() { 119 QuotaReservationManager* reservation_manager() {
119 return reservation_manager_.get(); 120 return reservation_manager_.get();
120 } 121 }
121 122
122 private: 123 private:
123 base::MessageLoop message_loop_; 124 base::test::ScopedTaskEnvironment scoped_task_environment_;
124 base::ScopedTempDir work_dir_; 125 base::ScopedTempDir work_dir_;
125 std::unique_ptr<storage::QuotaReservationManager> reservation_manager_; 126 std::unique_ptr<storage::QuotaReservationManager> reservation_manager_;
126 127
127 DISALLOW_COPY_AND_ASSIGN(QuotaReservationTest); 128 DISALLOW_COPY_AND_ASSIGN(QuotaReservationTest);
128 }; 129 };
129 130
130 void GotReservedQuota(int64_t* reserved_quota_ptr, 131 void GotReservedQuota(int64_t* reserved_quota_ptr,
131 ppapi::FileGrowthMap* file_growths_ptr, 132 ppapi::FileGrowthMap* file_growths_ptr,
132 int64_t reserved_quota, 133 int64_t reserved_quota,
133 const ppapi::FileSizeMap& maximum_written_offsets) { 134 const ppapi::FileSizeMap& maximum_written_offsets) {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 EXPECT_EQ(amount, reserved_quota); 244 EXPECT_EQ(amount, reserved_quota);
244 EXPECT_EQ(2U, file_growths.size()); 245 EXPECT_EQ(2U, file_growths.size());
245 EXPECT_EQ(file1_size, file_growths[kFile1ID].max_written_offset); 246 EXPECT_EQ(file1_size, file_growths[kFile1ID].max_written_offset);
246 EXPECT_EQ(file3_size, file_growths[kFile3ID].max_written_offset); 247 EXPECT_EQ(file3_size, file_growths[kFile3ID].max_written_offset);
247 248
248 test->CloseFile(kFile1ID, ppapi::FileGrowth(file1_size, 0)); 249 test->CloseFile(kFile1ID, ppapi::FileGrowth(file1_size, 0));
249 test->CloseFile(kFile3ID, ppapi::FileGrowth(file3_size, 0)); 250 test->CloseFile(kFile3ID, ppapi::FileGrowth(file3_size, 0));
250 } 251 }
251 252
252 } // namespace content 253 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/quota/usage_tracker_unittest.cc ('k') | content/child/indexed_db/webidbcursor_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698