| 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 "content/child/worker_task_runner.h" | 5 #include "content/child/worker_task_runner.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.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 | 11 |
| 12 namespace content { | 12 namespace content { |
| 13 | 13 |
| 14 class WorkerTaskRunnerTest : public testing::Test { | 14 class WorkerTaskRunnerTest : public testing::Test { |
| 15 public: | 15 public: |
| 16 void FakeStart() { | 16 void FakeStart() { |
| 17 task_runner_.OnWorkerRunLoopStarted(blink::WebWorkerRunLoop()); | 17 task_runner_.OnWorkerRunLoopStarted(); |
| 18 } | 18 } |
| 19 void FakeStop() { | 19 void FakeStop() { |
| 20 task_runner_.OnWorkerRunLoopStopped(blink::WebWorkerRunLoop()); | 20 task_runner_.OnWorkerRunLoopStopped(); |
| 21 } | 21 } |
| 22 WorkerTaskRunner task_runner_; | 22 WorkerTaskRunner task_runner_; |
| 23 | 23 |
| 24 private: | 24 private: |
| 25 base::MessageLoop message_loop_; | 25 base::MessageLoop message_loop_; |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 class MockObserver : public WorkerTaskRunner::Observer { | 28 class MockObserver : public WorkerTaskRunner::Observer { |
| 29 public: | 29 public: |
| 30 MOCK_METHOD0(OnWorkerRunLoopStopped, void()); | 30 MOCK_METHOD0(OnWorkerRunLoopStopped, void()); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 52 MockObserver o; | 52 MockObserver o; |
| 53 o.RemoveSelfOnNotify(); | 53 o.RemoveSelfOnNotify(); |
| 54 o.runner_ = &task_runner_; | 54 o.runner_ = &task_runner_; |
| 55 EXPECT_CALL(o, OnWorkerRunLoopStopped()).Times(1); | 55 EXPECT_CALL(o, OnWorkerRunLoopStopped()).Times(1); |
| 56 FakeStart(); | 56 FakeStart(); |
| 57 task_runner_.AddStopObserver(&o); | 57 task_runner_.AddStopObserver(&o); |
| 58 FakeStop(); | 58 FakeStop(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 } // namespace content | 61 } // namespace content |
| OLD | NEW |