diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-27 06:08:24 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-27 06:08:24 +0000 |
commit | 1771610df43ea45158fcb5f2776852f1e5f4e92b (patch) | |
tree | f32652253b296d125497b25dcc51534e4cbc677a /gin/test | |
parent | 2b2e427dcaa14737774a166adf38b68666bfad1e (diff) | |
download | chromium_src-1771610df43ea45158fcb5f2776852f1e5f4e92b.zip chromium_src-1771610df43ea45158fcb5f2776852f1e5f4e92b.tar.gz chromium_src-1771610df43ea45158fcb5f2776852f1e5f4e92b.tar.bz2 |
Refactors parts of gin:
. Runner no longer extends ContextHolder. It will still have a
ContextHolder, but not own it. This enables a couple of
things:
. Runner no longer need own a v8::Context.
. Runner can be lazily created after the ContextHolder.
. Runner becomes a (mostly) pure virtual interface. This enables an
implementation to execute through blink rather than v8 directly.
. What was Runner is now DefaultRunner (and
DefaultRunnerDelegate). I'm not a fan of these names, if you have
better ideas let me know. Maybe DirectRunner?
BUG=none
TEST=none
R=abarth@chromium.org
Review URL: https://codereview.chromium.org/179803007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@253732 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gin/test')
-rw-r--r-- | gin/test/file_runner.cc | 9 | ||||
-rw-r--r-- | gin/test/file_runner.h | 3 |
2 files changed, 7 insertions, 5 deletions
diff --git a/gin/test/file_runner.cc b/gin/test/file_runner.cc index 7b91273..86cb2f3 100644 --- a/gin/test/file_runner.cc +++ b/gin/test/file_runner.cc @@ -10,6 +10,7 @@ #include "gin/converter.h" #include "gin/modules/console.h" #include "gin/modules/module_registry.h" +#include "gin/public/context_holder.h" #include "gin/public/isolate_holder.h" #include "gin/test/gtest.h" #include "gin/try_catch.h" @@ -38,7 +39,7 @@ FileRunnerDelegate::FileRunnerDelegate() FileRunnerDelegate::~FileRunnerDelegate() { } -void FileRunnerDelegate::UnhandledException(Runner* runner, +void FileRunnerDelegate::UnhandledException(ShellRunner* runner, TryCatch& try_catch) { ModuleRunnerDelegate::UnhandledException(runner, try_catch); FAIL() << try_catch.GetStackTrace(); @@ -53,7 +54,7 @@ void RunTestFromFile(const base::FilePath& path, FileRunnerDelegate* delegate, base::MessageLoop message_loop; gin::IsolateHolder instance; - gin::Runner runner(delegate, instance.isolate()); + gin::ShellRunner runner(delegate, instance.isolate()); { gin::Runner::Scope scope(&runner); v8::V8::SetCaptureStackTraceForUncaughtExceptions(true); @@ -65,8 +66,8 @@ void RunTestFromFile(const base::FilePath& path, FileRunnerDelegate* delegate, message_loop.Run(); } - v8::Handle<v8::Value> result = runner.context()->Global()->Get( - StringToSymbol(runner.isolate(), "result")); + v8::Handle<v8::Value> result = runner.global()->Get( + StringToSymbol(runner.GetContextHolder()->isolate(), "result")); EXPECT_EQ("PASS", V8ToString(result)); } } diff --git a/gin/test/file_runner.h b/gin/test/file_runner.h index 267023d..f248fb5 100644 --- a/gin/test/file_runner.h +++ b/gin/test/file_runner.h @@ -24,7 +24,8 @@ class FileRunnerDelegate : public ModuleRunnerDelegate { private: // From ModuleRunnerDelegate: - virtual void UnhandledException(Runner* runner, TryCatch& try_catch) OVERRIDE; + virtual void UnhandledException(ShellRunner* runner, + TryCatch& try_catch) OVERRIDE; DISALLOW_COPY_AND_ASSIGN(FileRunnerDelegate); }; |