bfd37ab267
As per discussion on the V8 team, this is the place we want them to live, not following the Chrome Style Guide for this. BUG=v8:3489 LOG=y R=svenpanne@chromium.org Review URL: https://codereview.chromium.org/615393002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24350 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
44 lines
1.0 KiB
C++
44 lines
1.0 KiB
C++
// Copyright 2014 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "src/libplatform/default-platform.h"
|
|
#include "testing/gmock/include/gmock/gmock.h"
|
|
|
|
using testing::InSequence;
|
|
using testing::StrictMock;
|
|
|
|
namespace v8 {
|
|
namespace platform {
|
|
|
|
namespace {
|
|
|
|
struct MockTask : public Task {
|
|
virtual ~MockTask() { Die(); }
|
|
MOCK_METHOD0(Run, void());
|
|
MOCK_METHOD0(Die, void());
|
|
};
|
|
|
|
} // namespace
|
|
|
|
|
|
TEST(DefaultPlatformTest, PumpMessageLoop) {
|
|
InSequence s;
|
|
|
|
int dummy;
|
|
Isolate* isolate = reinterpret_cast<Isolate*>(&dummy);
|
|
|
|
DefaultPlatform platform;
|
|
EXPECT_FALSE(platform.PumpMessageLoop(isolate));
|
|
|
|
StrictMock<MockTask>* task = new StrictMock<MockTask>;
|
|
platform.CallOnForegroundThread(isolate, task);
|
|
EXPECT_CALL(*task, Run());
|
|
EXPECT_CALL(*task, Die());
|
|
EXPECT_TRUE(platform.PumpMessageLoop(isolate));
|
|
EXPECT_FALSE(platform.PumpMessageLoop(isolate));
|
|
}
|
|
|
|
} // namespace platform
|
|
} // namespace v8
|