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

Unified Diff: test/unittests/value-serializer-unittest.cc

Issue 2644083002: Clear unhandled scheduled exceptions from ValueSelializerTest (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/value-serializer-unittest.cc
diff --git a/test/unittests/value-serializer-unittest.cc b/test/unittests/value-serializer-unittest.cc
index 48ac722aa33bf4572bcefd9356495c45469364c5..6c02f2e3490288aacf23bda818cecf52ed357cfe 100644
--- a/test/unittests/value-serializer-unittest.cc
+++ b/test/unittests/value-serializer-unittest.cc
@@ -54,6 +54,17 @@ class ValueSerializerTest : public TestWithIsolate {
.ToChecked();
}
host_object_constructor_template_ = function_template;
+ isolate_ = reinterpret_cast<i::Isolate*>(isolate());
+ }
+
+ ~ValueSerializerTest() {
+ // In some cases unhandled scheduled exceptions from current test produce
+ // that Context::New(isolate()) from next test's constructor returns NULL.
+ // In order to prevent that, we added destructor which will clear scheduled
+ // exceptions just for the current test from test case.
+ if (isolate_->has_scheduled_exception()) {
+ isolate_->clear_scheduled_exception();
+ }
}
const Local<Context>& serialization_context() {
@@ -256,6 +267,7 @@ class ValueSerializerTest : public TestWithIsolate {
Local<Context> serialization_context_;
Local<Context> deserialization_context_;
Local<FunctionTemplate> host_object_constructor_template_;
+ i::Isolate* isolate_;
DISALLOW_COPY_AND_ASSIGN(ValueSerializerTest);
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698