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

Unified Diff: mojo/dart/embedder/test/validation_unittest.cc

Issue 1411843005: Dart: Removes C++ set for closing handles on an unhandled exception. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Address comments Created 5 years, 2 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
Index: mojo/dart/embedder/test/validation_unittest.cc
diff --git a/mojo/dart/embedder/test/validation_unittest.cc b/mojo/dart/embedder/test/validation_unittest.cc
index 181f0bab8ada03213969da5bd5b6a05acc8431ef..8ee3e1e3dde9b671576fa7b4110ea4bb14e23551 100644
--- a/mojo/dart/embedder/test/validation_unittest.cc
+++ b/mojo/dart/embedder/test/validation_unittest.cc
@@ -42,8 +42,12 @@ static bool generateEntropy(uint8_t* buffer, intptr_t length) {
return true;
}
-static void exceptionCallback(bool* exception, Dart_Handle error) {
+static void exceptionCallback(bool* exception,
+ int64_t* closed_handles,
+ Dart_Handle error,
+ int64_t count) {
*exception = true;
+ *closed_handles = count;
}
// Enumerates files inside |path| and collects all data needed to run
@@ -120,6 +124,7 @@ static void RunTest(const std::string& test) {
char* error = NULL;
bool unhandled_exception = false;
+ int64_t closed_handles = 0;
DartControllerConfig config;
// Run with strict compilation even in Release mode so that ASAN testing gets
// coverage of Dart asserts, type-checking, etc.
@@ -127,7 +132,7 @@ static void RunTest(const std::string& test) {
config.script_uri = path.value();
config.package_root = package_root.AsUTF8Unsafe();
config.callbacks.exception =
- base::Bind(&exceptionCallback, &unhandled_exception);
+ base::Bind(&exceptionCallback, &unhandled_exception, &closed_handles);
config.entropy = generateEntropy;
config.SetVmFlags(nullptr, 0);
config.error = &error;
@@ -136,6 +141,7 @@ static void RunTest(const std::string& test) {
bool success = DartController::RunSingleDartScript(config);
EXPECT_TRUE(success) << error;
EXPECT_FALSE(unhandled_exception);
+ EXPECT_EQ(closed_handles, 0);
}
TEST(DartTest, validation) {

Powered by Google App Engine
This is Rietveld 408576698