Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Unified Diff: src/libplatform/default-platform-unittest.cc

Issue 526043002: Refactor libplatform unit tests to use GTest/GMock. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Integrate into test driver. Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/all.gyp ('k') | src/libplatform/libplatform.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/libplatform/default-platform-unittest.cc
diff --git a/src/libplatform/default-platform-unittest.cc b/src/libplatform/default-platform-unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d2c160e5587557c72c5c138e4a826784aaa4cdb9
--- /dev/null
+++ b/src/libplatform/default-platform-unittest.cc
@@ -0,0 +1,43 @@
+// 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
« no previous file with comments | « build/all.gyp ('k') | src/libplatform/libplatform.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698