Revert of Update V8 to version 4.5.70. (patchset #1 id:1 of https://codereview.chromi...
[chromium-blink-merge.git] / jingle / glue / task_pump_unittest.cc
blob0782f8fdaee18181571820be5b2de78873b508f0
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "jingle/glue/task_pump.h"
7 #include "base/message_loop/message_loop.h"
8 #include "jingle/glue/mock_task.h"
9 #include "testing/gtest/include/gtest/gtest.h"
11 namespace jingle_glue {
13 namespace {
15 using ::testing::Return;
17 class TaskPumpTest : public testing::Test {
18 private:
19 base::MessageLoop message_loop_;
22 TEST_F(TaskPumpTest, Basic) {
23 TaskPump task_pump;
24 MockTask* task = new MockTask(&task_pump);
25 // We have to do this since the state enum is protected in
26 // rtc::Task.
27 const int TASK_STATE_DONE = 2;
28 EXPECT_CALL(*task, ProcessStart()).WillOnce(Return(TASK_STATE_DONE));
29 task->Start();
31 base::MessageLoop::current()->RunUntilIdle();
34 TEST_F(TaskPumpTest, Stop) {
35 TaskPump task_pump;
36 MockTask* task = new MockTask(&task_pump);
37 // We have to do this since the state enum is protected in
38 // rtc::Task.
39 const int TASK_STATE_ERROR = 3;
40 ON_CALL(*task, ProcessStart()).WillByDefault(Return(TASK_STATE_ERROR));
41 EXPECT_CALL(*task, ProcessStart()).Times(0);
42 task->Start();
44 task_pump.Stop();
45 base::MessageLoop::current()->RunUntilIdle();
48 } // namespace
50 } // namespace jingle_glue