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.
7 #include "src/libplatform/default-platform.h"
8 #include "test/cctest/cctest.h"
9 #include "test/cctest/test-libplatform.h"
11 using namespace v8::internal;
12 using namespace v8::platform;
15 TEST(DefaultPlatformMessagePump) {
16 TaskCounter task_counter;
18 DefaultPlatform platform;
20 TestTask* task = new TestTask(&task_counter, true);
22 CHECK(!platform.PumpMessageLoop(CcTest::isolate()));
24 platform.CallOnForegroundThread(CcTest::isolate(), task);
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()));