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

Unified Diff: Source/WebKit/chromium/tests/IDBBindingUtilitiesTest.cpp

Issue 11348011: Revert 128789 - IndexedDB: Use ScriptValue instead of SerializedScriptValue for get/openCursor (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1271/
Patch Set: Created 8 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: Source/WebKit/chromium/tests/IDBBindingUtilitiesTest.cpp
===================================================================
--- Source/WebKit/chromium/tests/IDBBindingUtilitiesTest.cpp (revision 132816)
+++ Source/WebKit/chromium/tests/IDBBindingUtilitiesTest.cpp (working copy)
@@ -27,6 +27,7 @@
#include "IDBBindingUtilities.h"
#include "IDBKey.h"
#include "IDBKeyPath.h"
+#include "SerializedScriptValue.h"
#include "V8PerIsolateData.h"
#include "V8Utilities.h"
@@ -39,42 +40,41 @@
namespace {
-PassRefPtr<IDBKey> checkKeyFromValueAndKeyPathInternal(const ScriptValue& value, const String& keyPath)
+PassRefPtr<IDBKey> checkKeyFromValueAndKeyPathInternal(SerializedScriptValue* value, const String& keyPath)
{
IDBKeyPath idbKeyPath(keyPath);
EXPECT_TRUE(idbKeyPath.isValid());
-
- return createIDBKeyFromScriptValueAndKeyPath(value, idbKeyPath);
+ return createIDBKeyFromSerializedValueAndKeyPath(value, idbKeyPath);
}
-void checkKeyPathNullValue(const ScriptValue& value, const String& keyPath)
+void checkKeyPathNullValue(SerializedScriptValue* value, const String& keyPath)
{
RefPtr<IDBKey> idbKey = checkKeyFromValueAndKeyPathInternal(value, keyPath);
ASSERT_FALSE(idbKey.get());
}
-bool injectKey(PassRefPtr<IDBKey> key, ScriptValue& value, const String& keyPath)
+PassRefPtr<SerializedScriptValue> injectKey(PassRefPtr<IDBKey> key, PassRefPtr<SerializedScriptValue> value, const String& keyPath)
{
IDBKeyPath idbKeyPath(keyPath);
EXPECT_TRUE(idbKeyPath.isValid());
- return injectIDBKeyIntoScriptValue(key, value, idbKeyPath);
+ return injectIDBKeyIntoSerializedValue(key, value, idbKeyPath);
}
-void checkInjection(PassRefPtr<IDBKey> prpKey, ScriptValue& value, const String& keyPath)
+void checkInjection(PassRefPtr<IDBKey> prpKey, PassRefPtr<SerializedScriptValue> value, const String& keyPath)
{
RefPtr<IDBKey> key = prpKey;
- bool result = injectKey(key, value, keyPath);
- ASSERT_TRUE(result);
- RefPtr<IDBKey> extractedKey = checkKeyFromValueAndKeyPathInternal(value, keyPath);
+ RefPtr<SerializedScriptValue> newValue = injectKey(key, value, keyPath);
+ ASSERT_TRUE(newValue);
+ RefPtr<IDBKey> extractedKey = checkKeyFromValueAndKeyPathInternal(newValue.get(), keyPath);
EXPECT_TRUE(key->isEqual(extractedKey.get()));
}
-void checkInjectionFails(PassRefPtr<IDBKey> key, ScriptValue& value, const String& keyPath)
+void checkInjectionFails(PassRefPtr<IDBKey> key, PassRefPtr<SerializedScriptValue> value, const String& keyPath)
{
EXPECT_FALSE(injectKey(key, value, keyPath));
}
-void checkKeyPathStringValue(const ScriptValue& value, const String& keyPath, const String& expected)
+void checkKeyPathStringValue(SerializedScriptValue* value, const String& keyPath, const String& expected)
{
RefPtr<IDBKey> idbKey = checkKeyFromValueAndKeyPathInternal(value, keyPath);
ASSERT_TRUE(idbKey.get());
@@ -82,7 +82,7 @@
ASSERT_TRUE(expected == idbKey->string());
}
-void checkKeyPathNumberValue(const ScriptValue& value, const String& keyPath, int expected)
+void checkKeyPathNumberValue(SerializedScriptValue* value, const String& keyPath, int expected)
{
RefPtr<IDBKey> idbKey = checkKeyFromValueAndKeyPathInternal(value, keyPath);
ASSERT_TRUE(idbKey.get());
@@ -98,10 +98,10 @@
v8::Local<v8::Object> object = v8::Object::New();
object->Set(v8::String::New("foo"), v8::String::New("zoo"));
- ScriptValue scriptValue(object);
+ RefPtr<SerializedScriptValue> serializedScriptValue = SerializedScriptValue::create(object);
- checkKeyPathStringValue(scriptValue, "foo", "zoo");
- checkKeyPathNullValue(scriptValue, "bar");
+ checkKeyPathStringValue(serializedScriptValue.get(), "foo", "zoo");
+ checkKeyPathNullValue(serializedScriptValue.get(), "bar");
}
TEST(IDBKeyFromValueAndKeyPathTest, TopLevelPropertyNumberValue)
@@ -112,10 +112,10 @@
v8::Local<v8::Object> object = v8::Object::New();
object->Set(v8::String::New("foo"), v8::Number::New(456));
- ScriptValue scriptValue(object);
+ RefPtr<SerializedScriptValue> serializedScriptValue = SerializedScriptValue::create(object);
- checkKeyPathNumberValue(scriptValue, "foo", 456);
- checkKeyPathNullValue(scriptValue, "bar");
+ checkKeyPathNumberValue(serializedScriptValue.get(), "foo", 456);
+ checkKeyPathNullValue(serializedScriptValue.get(), "bar");
}
TEST(IDBKeyFromValueAndKeyPathTest, SubProperty)
@@ -128,10 +128,10 @@
subProperty->Set(v8::String::New("bar"), v8::String::New("zee"));
object->Set(v8::String::New("foo"), subProperty);
- ScriptValue scriptValue(object);
+ RefPtr<SerializedScriptValue> serializedScriptValue = SerializedScriptValue::create(object);
- checkKeyPathStringValue(scriptValue, "foo.bar", "zee");
- checkKeyPathNullValue(scriptValue, "bar");
+ checkKeyPathStringValue(serializedScriptValue.get(), "foo.bar", "zee");
+ checkKeyPathNullValue(serializedScriptValue.get(), "bar");
}
TEST(InjectIDBKeyTest, TopLevelPropertyStringValue)
@@ -142,11 +142,10 @@
v8::Local<v8::Object> object = v8::Object::New();
object->Set(v8::String::New("foo"), v8::String::New("zoo"));
- ScriptValue foozoo(object);
- checkInjection(IDBKey::createString("myNewKey"), foozoo, "bar");
- checkInjection(IDBKey::createNumber(1234), foozoo, "bar");
+ checkInjection(IDBKey::createString("myNewKey"), SerializedScriptValue::create(object), "bar");
+ checkInjection(IDBKey::createNumber(1234), SerializedScriptValue::create(object), "bar");
- checkInjectionFails(IDBKey::createString("key"), foozoo, "foo.bar");
+ checkInjectionFails(IDBKey::createString("key"), SerializedScriptValue::create(object), "foo.bar");
}
TEST(InjectIDBKeyTest, SubProperty)
@@ -159,16 +158,15 @@
subProperty->Set(v8::String::New("bar"), v8::String::New("zee"));
object->Set(v8::String::New("foo"), subProperty);
- ScriptValue scriptObject(object);
- checkInjection(IDBKey::createString("myNewKey"), scriptObject, "foo.baz");
- checkInjection(IDBKey::createNumber(789), scriptObject, "foo.baz");
- checkInjection(IDBKey::createDate(4567), scriptObject, "foo.baz");
- checkInjection(IDBKey::createDate(4567), scriptObject, "bar");
- checkInjection(IDBKey::createArray(IDBKey::KeyArray()), scriptObject, "foo.baz");
- checkInjection(IDBKey::createArray(IDBKey::KeyArray()), scriptObject, "bar");
+ checkInjection(IDBKey::createString("myNewKey"), SerializedScriptValue::create(object), "foo.baz");
+ checkInjection(IDBKey::createNumber(789), SerializedScriptValue::create(object), "foo.baz");
+ checkInjection(IDBKey::createDate(4567), SerializedScriptValue::create(object), "foo.baz");
+ checkInjection(IDBKey::createDate(4567), SerializedScriptValue::create(object), "bar");
+ checkInjection(IDBKey::createArray(IDBKey::KeyArray()), SerializedScriptValue::create(object), "foo.baz");
+ checkInjection(IDBKey::createArray(IDBKey::KeyArray()), SerializedScriptValue::create(object), "bar");
- checkInjectionFails(IDBKey::createString("zoo"), scriptObject, "foo.bar.baz");
- checkInjection(IDBKey::createString("zoo"), scriptObject, "foo.xyz.foo");
+ checkInjectionFails(IDBKey::createString("zoo"), SerializedScriptValue::create(object), "foo.bar.baz");
+ checkInjection(IDBKey::createString("zoo"), SerializedScriptValue::create(object), "foo.xyz.foo");
}
} // namespace
« no previous file with comments | « Source/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp ('k') | Source/WebKit/chromium/tests/IDBKeyPathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698