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

Unified Diff: test/cctest/test-libplatform-default-platform.cc

Issue 363303002: Add an API to pump the message loop to libplatform (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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
« include/libplatform/libplatform.h ('K') | « test/cctest/cctest.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-libplatform-default-platform.cc
diff --git a/test/cctest/test-libplatform-default-platform.cc b/test/cctest/test-libplatform-default-platform.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e6581eff2fdb625750b58886260b25517d4b81de
--- /dev/null
+++ b/test/cctest/test-libplatform-default-platform.cc
@@ -0,0 +1,31 @@
+// 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/v8.h"
+
+#include "src/libplatform/default-platform.h"
+#include "test/cctest/cctest.h"
+#include "test/cctest/test-libplatform.h"
+
+using namespace v8::internal;
+using namespace v8::platform;
+
+
+TEST(DefaultPlatformMessagePump) {
+ TaskCounter task_counter;
+
+ DefaultPlatform* platform = new DefaultPlatform();
marja 2014/07/03 09:26:35 Nit: no need to allocate this on the heap really,
+
+ TestTask* task = new TestTask(&task_counter, true);
+
+ CHECK(!platform->PumpMessageLoop(CcTest::isolate()));
+
+ platform->CallOnForegroundThread(CcTest::isolate(), task);
+
+ CHECK_EQ(1, task_counter.GetCount());
+ CHECK(platform->PumpMessageLoop(CcTest::isolate()));
+ CHECK_EQ(0, task_counter.GetCount());
+ CHECK(!platform->PumpMessageLoop(CcTest::isolate()));
+ delete platform;
+}
« include/libplatform/libplatform.h ('K') | « test/cctest/cctest.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698