diff options
Diffstat (limited to 'Source/WebKit/chromium/tests/IDBBindingUtilitiesTest.cpp')
| -rw-r--r-- | Source/WebKit/chromium/tests/IDBBindingUtilitiesTest.cpp | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/Source/WebKit/chromium/tests/IDBBindingUtilitiesTest.cpp b/Source/WebKit/chromium/tests/IDBBindingUtilitiesTest.cpp index 46710e745..a2a4f442d 100644 --- a/Source/WebKit/chromium/tests/IDBBindingUtilitiesTest.cpp +++ b/Source/WebKit/chromium/tests/IDBBindingUtilitiesTest.cpp @@ -24,11 +24,19 @@ */ #include "config.h" +#include "Document.h" +#include "Frame.h" +#include "FrameTestHelpers.h" #include "IDBBindingUtilities.h" #include "IDBKey.h" #include "IDBKeyPath.h" +#include "V8Binding.h" #include "V8PerIsolateData.h" #include "V8Utilities.h" +#include "WebFrame.h" +#include "WebFrameImpl.h" +#include "WebView.h" +#include "WorldContextHandle.h" #include <gtest/gtest.h> #include <wtf/Vector.h> @@ -36,6 +44,7 @@ #if ENABLE(INDEXED_DATABASE) using namespace WebCore; +using namespace WebKit; namespace { @@ -90,10 +99,21 @@ void checkKeyPathNumberValue(const ScriptValue& value, const String& keyPath, in ASSERT_TRUE(expected == idbKey->number()); } +static v8::Handle<v8::Context> context() +{ + static WebView* webView; + if (!webView) { + webView = FrameTestHelpers::createWebViewAndLoad("about:blank"); + webView->setFocus(true); + } + ScriptExecutionContext* context = static_cast<WebFrameImpl*>(webView->mainFrame())->frame()->document(); + return toV8Context(context, WorldContextHandle(UseCurrentWorld)); +} + TEST(IDBKeyFromValueAndKeyPathTest, TopLevelPropertyStringValue) { v8::HandleScope handleScope; - v8::Context::Scope scope(V8PerIsolateData::current()->ensureAuxiliaryContext()); + v8::Context::Scope scope(context()); v8::Local<v8::Object> object = v8::Object::New(); object->Set(v8::String::New("foo"), v8::String::New("zoo")); @@ -107,7 +127,7 @@ TEST(IDBKeyFromValueAndKeyPathTest, TopLevelPropertyStringValue) TEST(IDBKeyFromValueAndKeyPathTest, TopLevelPropertyNumberValue) { v8::HandleScope handleScope; - v8::Context::Scope scope(V8PerIsolateData::current()->ensureAuxiliaryContext()); + v8::Context::Scope scope(context()); v8::Local<v8::Object> object = v8::Object::New(); object->Set(v8::String::New("foo"), v8::Number::New(456)); @@ -121,7 +141,7 @@ TEST(IDBKeyFromValueAndKeyPathTest, TopLevelPropertyNumberValue) TEST(IDBKeyFromValueAndKeyPathTest, SubProperty) { v8::HandleScope handleScope; - v8::Context::Scope scope(V8PerIsolateData::current()->ensureAuxiliaryContext()); + v8::Context::Scope scope(context()); v8::Local<v8::Object> object = v8::Object::New(); v8::Local<v8::Object> subProperty = v8::Object::New(); @@ -137,7 +157,7 @@ TEST(IDBKeyFromValueAndKeyPathTest, SubProperty) TEST(InjectIDBKeyTest, TopLevelPropertyStringValue) { v8::HandleScope handleScope; - v8::Context::Scope scope(V8PerIsolateData::current()->ensureAuxiliaryContext()); + v8::Context::Scope scope(context()); v8::Local<v8::Object> object = v8::Object::New(); object->Set(v8::String::New("foo"), v8::String::New("zoo")); @@ -152,7 +172,7 @@ TEST(InjectIDBKeyTest, TopLevelPropertyStringValue) TEST(InjectIDBKeyTest, SubProperty) { v8::HandleScope handleScope; - v8::Context::Scope scope(V8PerIsolateData::current()->ensureAuxiliaryContext()); + v8::Context::Scope scope(context()); v8::Local<v8::Object> object = v8::Object::New(); v8::Local<v8::Object> subProperty = v8::Object::New(); |
