| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/child/scheduler/webthread_impl_for_worker_scheduler.h" | 5 #include "components/scheduler/child/webthread_impl_for_worker_scheduler.h" |
| 6 | 6 |
| 7 #include "base/synchronization/waitable_event.h" | 7 #include "base/synchronization/waitable_event.h" |
| 8 #include "content/child/scheduler/worker_scheduler_impl.h" | 8 #include "components/scheduler/child/worker_scheduler_impl.h" |
| 9 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 #include "third_party/WebKit/public/platform/WebTraceLocation.h" | 11 #include "third_party/WebKit/public/platform/WebTraceLocation.h" |
| 12 | 12 |
| 13 using testing::_; | 13 using testing::_; |
| 14 using testing::AnyOf; | 14 using testing::AnyOf; |
| 15 using testing::ElementsAre; | 15 using testing::ElementsAre; |
| 16 using testing::Invoke; | 16 using testing::Invoke; |
| 17 | 17 |
| 18 namespace content { | 18 namespace scheduler { |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 class NopTask : public blink::WebThread::Task { | 21 class NopTask : public blink::WebThread::Task { |
| 22 public: | 22 public: |
| 23 ~NopTask() override {} | 23 ~NopTask() override {} |
| 24 | 24 |
| 25 void run() {} | 25 void run() {} |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 class MockTask : public blink::WebThread::Task { | 28 class MockTask : public blink::WebThread::Task { |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 base::Bind(&removeTaskObserver, thread_.get(), &observer)); | 160 base::Bind(&removeTaskObserver, thread_.get(), &observer)); |
| 161 | 161 |
| 162 // We need to be careful what we test here. We want to make sure the | 162 // We need to be careful what we test here. We want to make sure the |
| 163 // observers are un in the expected order before and after the task. | 163 // observers are un in the expected order before and after the task. |
| 164 // Sometimes we get an internal scheduler task running before or after | 164 // Sometimes we get an internal scheduler task running before or after |
| 165 // TestTask as well. This is not a bug, and we need to make sure the test | 165 // TestTask as well. This is not a bug, and we need to make sure the test |
| 166 // doesn't fail when that happens. | 166 // doesn't fail when that happens. |
| 167 EXPECT_THAT(calls, testing::HasSubstr("willProcessTask run didProcessTask")); | 167 EXPECT_THAT(calls, testing::HasSubstr("willProcessTask run didProcessTask")); |
| 168 } | 168 } |
| 169 | 169 |
| 170 } // namespace content | 170 } // namespace scheduler |
| OLD | NEW |