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

Side by Side Diff: components/sync/model_impl/attachments/task_queue_unittest.cc

Issue 2422253002: [Sync] Rewriting ".reset(new" pattern to use "= base::MakeUnique" instead. (Closed)
Patch Set: Fixing compile. Created 4 years, 2 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 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 "components/sync/model_impl/attachments/task_queue.h" 5 #include "components/sync/model_impl/attachments/task_queue.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
11 #include "base/timer/mock_timer.h" 11 #include "base/timer/mock_timer.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 13
14 using base::TimeDelta; 14 using base::TimeDelta;
15 15
16 namespace syncer { 16 namespace syncer {
17 17
18 namespace { 18 namespace {
19 19
20 const TimeDelta kZero; 20 const TimeDelta kZero;
21 21
22 } // namespace 22 } // namespace
23 23
24 class TaskQueueTest : public testing::Test { 24 class TaskQueueTest : public testing::Test {
25 protected: 25 protected:
26 TaskQueueTest() : weak_ptr_factory_(this) { 26 TaskQueueTest() : weak_ptr_factory_(this) {
27 queue_.reset(new TaskQueue<int>( 27 queue_ = base::MakeUnique<TaskQueue<int>>(
28 base::Bind(&TaskQueueTest::Process, weak_ptr_factory_.GetWeakPtr()), 28 base::Bind(&TaskQueueTest::Process, weak_ptr_factory_.GetWeakPtr()),
29 TimeDelta::FromMinutes(1), TimeDelta::FromMinutes(8))); 29 TimeDelta::FromMinutes(1), TimeDelta::FromMinutes(8));
30 } 30 }
31 31
32 void RunLoop() { 32 void RunLoop() {
33 base::RunLoop run_loop; 33 base::RunLoop run_loop;
34 run_loop.RunUntilIdle(); 34 run_loop.RunUntilIdle();
35 } 35 }
36 36
37 void Process(const int& task) { dispatched_.push_back(task); } 37 void Process(const int& task) { dispatched_.push_back(task); }
38 38
39 base::MessageLoop message_loop_; 39 base::MessageLoop message_loop_;
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 mock_timer->Fire(); 223 mock_timer->Fire();
224 RunLoop(); 224 RunLoop();
225 ASSERT_FALSE(mock_timer->IsRunning()); 225 ASSERT_FALSE(mock_timer->IsRunning());
226 ASSERT_EQ(1U, dispatched_.size()); 226 ASSERT_EQ(1U, dispatched_.size());
227 EXPECT_EQ(1, dispatched_.front()); 227 EXPECT_EQ(1, dispatched_.front());
228 dispatched_.clear(); 228 dispatched_.clear();
229 queue_->MarkAsSucceeded(1); 229 queue_->MarkAsSucceeded(1);
230 } 230 }
231 231
232 } // namespace syncer 232 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/model_impl/attachments/task_queue.h ('k') | components/sync/model_impl/model_type_store_backend_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698