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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 explicit FakeTaskRunner(std::vector<int64_t>* delays) : delays_(delays) {} | 60 explicit FakeTaskRunner(std::vector<int64_t>* delays) : delays_(delays) {} |
61 | 61 |
62 // base::TaskRunner overrides: | 62 // base::TaskRunner overrides: |
63 bool PostDelayedTask(const tracked_objects::Location& from_here, | 63 bool PostDelayedTask(const tracked_objects::Location& from_here, |
64 base::OnceClosure task, | 64 base::OnceClosure task, |
65 base::TimeDelta delay) override { | 65 base::TimeDelta delay) override { |
66 delays_->push_back(delay.InMilliseconds()); | 66 delays_->push_back(delay.InMilliseconds()); |
67 base::ThreadTaskRunnerHandle::Get()->PostTask(from_here, std::move(task)); | 67 base::ThreadTaskRunnerHandle::Get()->PostTask(from_here, std::move(task)); |
68 return true; | 68 return true; |
69 } | 69 } |
70 bool RunsTasksOnCurrentThread() const override { return true; } | 70 bool RunsTasksInCurrentSequence() const override { return true; } |
71 | 71 |
72 protected: | 72 protected: |
73 ~FakeTaskRunner() override {} | 73 ~FakeTaskRunner() override {} |
74 | 74 |
75 private: | 75 private: |
76 // The vector of delays. | 76 // The vector of delays. |
77 std::vector<int64_t>* delays_; | 77 std::vector<int64_t>* delays_; |
78 | 78 |
79 DISALLOW_COPY_AND_ASSIGN(FakeTaskRunner); | 79 DISALLOW_COPY_AND_ASSIGN(FakeTaskRunner); |
80 }; | 80 }; |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 EXPECT_EQ("2222", reported_info.pin); | 514 EXPECT_EQ("2222", reported_info.pin); |
515 EXPECT_EQ(1, reported_info.slot_id); | 515 EXPECT_EQ(1, reported_info.slot_id); |
516 | 516 |
517 const int64_t kExpectedDelays[] = {100}; | 517 const int64_t kExpectedDelays[] = {100}; |
518 EXPECT_EQ(std::vector<int64_t>(kExpectedDelays, | 518 EXPECT_EQ(std::vector<int64_t>(kExpectedDelays, |
519 kExpectedDelays + arraysize(kExpectedDelays)), | 519 kExpectedDelays + arraysize(kExpectedDelays)), |
520 delays_); | 520 delays_); |
521 } | 521 } |
522 | 522 |
523 } // namespace | 523 } // namespace |
OLD | NEW |