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

Unified Diff: chrome/test/base/module_system_test.cc

Issue 11312157: Add ExceptionHandler to ModuleSystem, remove heap allocated v8::TryCatch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rename dispatchJSON -> dispatchEvent Created 8 years 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 | « chrome/test/base/module_system_test.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/base/module_system_test.cc
diff --git a/chrome/test/base/module_system_test.cc b/chrome/test/base/module_system_test.cc
index 1f7b75bece80bc60abd430553025103e1d964bc4..365ea7ff1fa089de2afd0d95a3fd0725c8ec38a7 100644
--- a/chrome/test/base/module_system_test.cc
+++ b/chrome/test/base/module_system_test.cc
@@ -75,6 +75,13 @@ class StringSourceMap : public ModuleSystem::SourceMap {
std::map<std::string, std::string> source_map_;
};
+class FailsOnException : public ModuleSystem::ExceptionHandler {
+ public:
+ virtual void HandleUncaughtException() {
+ FAIL();
+ }
+};
+
ModuleSystemTest::ModuleSystemTest()
: context_(v8::Context::New()),
source_map_(new StringSourceMap()),
@@ -84,7 +91,8 @@ ModuleSystemTest::ModuleSystemTest()
module_system_.reset(new ModuleSystem(context_, source_map_.get()));
module_system_->RegisterNativeHandler("assert", scoped_ptr<NativeHandler>(
assert_natives_));
- try_catch_.SetCaptureMessage(true);
+ module_system_->set_exception_handler(
+ scoped_ptr<ModuleSystem::ExceptionHandler>(new FailsOnException));
}
ModuleSystemTest::~ModuleSystemTest() {
@@ -112,9 +120,6 @@ void ModuleSystemTest::OverrideNativeHandler(const std::string& name,
}
void ModuleSystemTest::TearDown() {
- if (try_catch_.HasCaught())
- ModuleSystem::DumpException(try_catch_);
- EXPECT_FALSE(try_catch_.HasCaught());
// All tests must assert at least once unless otherwise specified.
EXPECT_EQ(should_assertions_be_made_,
assert_natives_->assertion_made());
« no previous file with comments | « chrome/test/base/module_system_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698