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

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

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 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 "sync/internal_api/public/attachments/task_queue.h" 5 #include "components/sync/core/attachments/task_queue.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/run_loop.h" 13 #include "base/run_loop.h"
14 #include "base/timer/mock_timer.h" 14 #include "base/timer/mock_timer.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 using base::TimeDelta; 17 using base::TimeDelta;
18 18
19 namespace syncer { 19 namespace syncer {
20 20
21 namespace { 21 namespace {
22 22
23 const TimeDelta kZero; 23 const TimeDelta kZero;
24 24
25 } // namespace 25 } // namespace
26 26
27 class TaskQueueTest : public testing::Test { 27 class TaskQueueTest : public testing::Test {
28 protected: 28 protected:
29 TaskQueueTest() : weak_ptr_factory_(this) { 29 TaskQueueTest() : weak_ptr_factory_(this) {
30 queue_.reset(new TaskQueue<int>( 30 queue_.reset(new TaskQueue<int>(
31 base::Bind(&TaskQueueTest::Process, weak_ptr_factory_.GetWeakPtr()), 31 base::Bind(&TaskQueueTest::Process, weak_ptr_factory_.GetWeakPtr()),
32 TimeDelta::FromMinutes(1), 32 TimeDelta::FromMinutes(1), TimeDelta::FromMinutes(8)));
33 TimeDelta::FromMinutes(8)));
34 } 33 }
35 34
36 void RunLoop() { 35 void RunLoop() {
37 base::RunLoop run_loop; 36 base::RunLoop run_loop;
38 run_loop.RunUntilIdle(); 37 run_loop.RunUntilIdle();
39 } 38 }
40 39
41 void Process(const int& task) { dispatched_.push_back(task); } 40 void Process(const int& task) { dispatched_.push_back(task); }
42 41
43 base::MessageLoop message_loop_; 42 base::MessageLoop message_loop_;
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 mock_timer->Fire(); 226 mock_timer->Fire();
228 RunLoop(); 227 RunLoop();
229 ASSERT_FALSE(mock_timer->IsRunning()); 228 ASSERT_FALSE(mock_timer->IsRunning());
230 ASSERT_EQ(1U, dispatched_.size()); 229 ASSERT_EQ(1U, dispatched_.size());
231 EXPECT_EQ(1, dispatched_.front()); 230 EXPECT_EQ(1, dispatched_.front());
232 dispatched_.clear(); 231 dispatched_.clear();
233 queue_->MarkAsSucceeded(1); 232 queue_->MarkAsSucceeded(1);
234 } 233 }
235 234
236 } // namespace syncer 235 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/core_impl/attachments/task_queue.cc ('k') | components/sync/core_impl/change_reorder_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698