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

Unified Diff: test/cctest/test-api.h

Issue 900033003: split interceptor tests off of test-api (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 | « test/cctest/cctest.status ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.h
diff --git a/test/cctest/test-api.h b/test/cctest/test-api.h
new file mode 100644
index 0000000000000000000000000000000000000000..17e0711af55fee0288fafa0ac7976e0007d86e20
--- /dev/null
+++ b/test/cctest/test-api.h
@@ -0,0 +1,34 @@
+// Copyright 2015 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/cpu-profiler.h"
+#include "src/isolate.h"
+#include "src/vm-state.h"
+#include "test/cctest/cctest.h"
+
+template <typename T>
+static void CheckReturnValue(const T& t, i::Address callback) {
+ v8::ReturnValue<v8::Value> rv = t.GetReturnValue();
+ i::Object** o = *reinterpret_cast<i::Object***>(&rv);
+ CHECK_EQ(CcTest::isolate(), t.GetIsolate());
+ CHECK_EQ(t.GetIsolate(), rv.GetIsolate());
+ CHECK((*o)->IsTheHole() || (*o)->IsUndefined());
+ // Verify reset
+ bool is_runtime = (*o)->IsTheHole();
+ rv.Set(true);
+ CHECK(!(*o)->IsTheHole() && !(*o)->IsUndefined());
+ rv.Set(v8::Handle<v8::Object>());
+ CHECK((*o)->IsTheHole() || (*o)->IsUndefined());
+ CHECK_EQ(is_runtime, (*o)->IsTheHole());
+ i::Isolate* isolate = reinterpret_cast<i::Isolate*>(t.GetIsolate());
+ // If CPU profiler is active check that when API callback is invoked
+ // VMState is set to EXTERNAL.
+ if (isolate->cpu_profiler()->is_profiling()) {
+ CHECK_EQ(v8::EXTERNAL, isolate->current_vm_state());
+ CHECK(isolate->external_callback_scope());
+ CHECK_EQ(callback, isolate->external_callback_scope()->callback());
+ }
+}
« no previous file with comments | « test/cctest/cctest.status ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698