OLD | NEW |
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 "chrome/browser/sync_file_system/drive_backend/sync_task_manager.h" | 5 #include "chrome/browser/sync_file_system/drive_backend/sync_task_manager.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <deque> | 8 #include <deque> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 void IncrementAndAssign(int expected_before_counter, | 41 void IncrementAndAssign(int expected_before_counter, |
42 int* counter, | 42 int* counter, |
43 SyncStatusCode* status_out, | 43 SyncStatusCode* status_out, |
44 SyncStatusCode status) { | 44 SyncStatusCode status) { |
45 EXPECT_EQ(expected_before_counter, *counter); | 45 EXPECT_EQ(expected_before_counter, *counter); |
46 ++(*counter); | 46 ++(*counter); |
47 *status_out = status; | 47 *status_out = status; |
48 } | 48 } |
49 | 49 |
50 template <typename T> | |
51 void IncrementAndAssignWithOwnedPointer(T* object, | |
52 int* counter, | |
53 SyncStatusCode* status_out, | |
54 SyncStatusCode status) { | |
55 ++(*counter); | |
56 *status_out = status; | |
57 } | |
58 | |
59 class TaskManagerClient | 50 class TaskManagerClient |
60 : public SyncTaskManager::Client, | 51 : public SyncTaskManager::Client, |
61 public base::SupportsWeakPtr<TaskManagerClient> { | 52 public base::SupportsWeakPtr<TaskManagerClient> { |
62 public: | 53 public: |
63 explicit TaskManagerClient(int64_t maximum_background_task) | 54 explicit TaskManagerClient(int64_t maximum_background_task) |
64 : maybe_schedule_next_task_count_(0), | 55 : maybe_schedule_next_task_count_(0), |
65 task_scheduled_count_(0), | 56 task_scheduled_count_(0), |
66 idle_task_scheduled_count_(0), | 57 idle_task_scheduled_count_(0), |
67 last_operation_status_(SYNC_STATUS_OK) { | 58 last_operation_status_(SYNC_STATUS_OK) { |
68 task_manager_.reset(new SyncTaskManager( | 59 task_manager_.reset(new SyncTaskManager( |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 | 631 |
641 EXPECT_EQ("task1: finished", log[i++]); | 632 EXPECT_EQ("task1: finished", log[i++]); |
642 | 633 |
643 EXPECT_EQ("task2: updating to /hoge/fuga/piyo", log[i++]); | 634 EXPECT_EQ("task2: updating to /hoge/fuga/piyo", log[i++]); |
644 EXPECT_EQ("task2: updated to /hoge/fuga/piyo", log[i++]); | 635 EXPECT_EQ("task2: updated to /hoge/fuga/piyo", log[i++]); |
645 EXPECT_EQ("task2: finished", log[i++]); | 636 EXPECT_EQ("task2: finished", log[i++]); |
646 } | 637 } |
647 | 638 |
648 } // namespace drive_backend | 639 } // namespace drive_backend |
649 } // namespace sync_file_system | 640 } // namespace sync_file_system |
OLD | NEW |