Upstream version 10.38.222.0
[platform/framework/web/crosswalk.git] / src / v8 / test / cctest / test-libplatform-default-platform.cc
1 // Copyright 2014 the V8 project 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.
4
5 #include "src/v8.h"
6
7 #include "src/libplatform/default-platform.h"
8 #include "test/cctest/cctest.h"
9 #include "test/cctest/test-libplatform.h"
10
11 using namespace v8::internal;
12 using namespace v8::platform;
13
14
15 TEST(DefaultPlatformMessagePump) {
16   TaskCounter task_counter;
17
18   DefaultPlatform platform;
19
20   TestTask* task = new TestTask(&task_counter, true);
21
22   CHECK(!platform.PumpMessageLoop(CcTest::isolate()));
23
24   platform.CallOnForegroundThread(CcTest::isolate(), task);
25
26   CHECK_EQ(1, task_counter.GetCount());
27   CHECK(platform.PumpMessageLoop(CcTest::isolate()));
28   CHECK_EQ(0, task_counter.GetCount());
29   CHECK(!platform.PumpMessageLoop(CcTest::isolate()));
30 }