diff options
-rw-r--r-- | content/browser/in_process_webkit/indexed_db_browsertest.cc | 9 | ||||
-rw-r--r-- | content/browser/in_process_webkit/indexed_db_uitest.cc | 2 | ||||
-rw-r--r-- | content/browser/indexed_db/idbbindingutilities_browsertest.cc | 119 | ||||
-rw-r--r-- | content/common/indexed_db/indexed_db_key.cc | 11 | ||||
-rw-r--r-- | content/common/indexed_db/indexed_db_key.h | 3 | ||||
-rw-r--r-- | content/common/indexed_db/indexed_db_param_traits.cc | 10 | ||||
-rw-r--r-- | webkit/glue/idb_bindings.cc | 7 |
7 files changed, 105 insertions, 56 deletions
diff --git a/content/browser/in_process_webkit/indexed_db_browsertest.cc b/content/browser/in_process_webkit/indexed_db_browsertest.cc index 4693b3b..09531283 100644 --- a/content/browser/in_process_webkit/indexed_db_browsertest.cc +++ b/content/browser/in_process_webkit/indexed_db_browsertest.cc @@ -60,19 +60,16 @@ class IndexedDBBrowserTest : public InProcessBrowserTest { } }; -// TODO(jsbell): Disabled to land WK76487; http://crbug.com/110956 has fix. -IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, DISABLED_CursorTest) { +IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, CursorTest) { SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("cursor_test.html")))); } -// TODO(jsbell): Disabled to land WK76487; http://crbug.com/110956 has fix. -IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, DISABLED_CursorTestIncognito) { +IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, CursorTestIncognito) { SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("cursor_test.html"))), true /* incognito */); } -// TODO(jsbell): Disabled to land WK76487; http://crbug.com/110956 has fix. -IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, DISABLED_CursorPrefetch) { +IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, CursorPrefetch) { SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("cursor_prefetch.html")))); } diff --git a/content/browser/in_process_webkit/indexed_db_uitest.cc b/content/browser/in_process_webkit/indexed_db_uitest.cc index ee427e5..99750c5 100644 --- a/content/browser/in_process_webkit/indexed_db_uitest.cc +++ b/content/browser/in_process_webkit/indexed_db_uitest.cc @@ -36,7 +36,7 @@ class IndexedDBUILayoutTest : public UILayoutTest { FilePath test_dir_; }; -TEST_F(IndexedDBUILayoutTest, DISABLED_LayoutTests) { +TEST_F(IndexedDBUILayoutTest, LayoutTests) { const int port = kNoHttpPort; InitializeForLayoutTest(test_dir_, FilePath(), port); AddJSTestResources(); diff --git a/content/browser/indexed_db/idbbindingutilities_browsertest.cc b/content/browser/indexed_db/idbbindingutilities_browsertest.cc index 0793e0b..b47645f 100644 --- a/content/browser/indexed_db/idbbindingutilities_browsertest.cc +++ b/content/browser/indexed_db/idbbindingutilities_browsertest.cc @@ -37,28 +37,46 @@ class ScopedShutdownWebKit { }; // Sanity test, check the function call directly outside the sandbox. -// TODO(jsbell): Disabled to land WK76487; http://crbug.com/110956 has fix. -TEST(IDBKeyPathWithoutSandbox, DISABLED_Value) { +TEST(IDBKeyPathWithoutSandbox, Value) { content::WebKitPlatformSupportImpl webkit_platform_support; WebKit::initialize(&webkit_platform_support); ScopedShutdownWebKit shutdown_webkit; - char16 data[] = {0x0353,0x6f66,0x536f,0x7a03,0x6f6f,0x017b}; + // {foo: "zoo"} + char16 data_foo_zoo[] = {0x0353,0x6f66,0x536f,0x7a03,0x6f6f,0x017b}; std::vector<WebSerializedScriptValue> serialized_values; serialized_values.push_back( - WebSerializedScriptValue::fromString(string16(data, arraysize(data)))); + WebSerializedScriptValue::fromString(string16(data_foo_zoo, + arraysize(data_foo_zoo)))); + + // {foo: null} + char16 data_foo_null[] = {0x0353, 0x6f66, 0x306f, 0x017b}; + serialized_values.push_back(content::SerializedScriptValue( + false, false, string16(data_foo_null, arraysize(data_foo_null)))); + + // {} + char16 data_object[] = {0x017b}; + serialized_values.push_back(content::SerializedScriptValue( + false, false, string16(data_object, arraysize(data_object)))); + + // null serialized_values.push_back( WebSerializedScriptValue::fromString(string16())); std::vector<WebKit::WebIDBKey> values; - string16 key_path(UTF8ToUTF16("foo")); - bool error = webkit_glue::IDBKeysFromValuesAndKeyPath( + string16 key_path; + bool error; + + key_path = UTF8ToUTF16("foo"); + error = webkit_glue::IDBKeysFromValuesAndKeyPath( serialized_values, key_path, &values); - ASSERT_EQ(size_t(2), values.size()); + ASSERT_EQ(size_t(4), values.size()); ASSERT_EQ(WebKit::WebIDBKey::StringType, values[0].type()); ASSERT_EQ(UTF8ToUTF16("zoo"), values[0].string()); ASSERT_EQ(WebKit::WebIDBKey::InvalidType, values[1].type()); + ASSERT_EQ(WebKit::WebIDBKey::NullType, values[2].type()); + ASSERT_EQ(WebKit::WebIDBKey::NullType, values[3].type()); ASSERT_FALSE(error); values.clear(); @@ -66,9 +84,11 @@ TEST(IDBKeyPathWithoutSandbox, DISABLED_Value) { error = webkit_glue::IDBKeysFromValuesAndKeyPath( serialized_values, key_path, &values); - ASSERT_EQ(size_t(2), values.size()); - ASSERT_EQ(WebKit::WebIDBKey::InvalidType, values[0].type()); - ASSERT_EQ(WebKit::WebIDBKey::InvalidType, values[1].type()); + ASSERT_EQ(size_t(4), values.size()); + ASSERT_EQ(WebKit::WebIDBKey::NullType, values[0].type()); + ASSERT_EQ(WebKit::WebIDBKey::NullType, values[1].type()); + ASSERT_EQ(WebKit::WebIDBKey::NullType, values[2].type()); + ASSERT_EQ(WebKit::WebIDBKey::NullType, values[3].type()); ASSERT_FALSE(error); values.clear(); @@ -77,9 +97,11 @@ TEST(IDBKeyPathWithoutSandbox, DISABLED_Value) { serialized_values, key_path, &values); ASSERT_TRUE(error); - ASSERT_EQ(size_t(2), values.size()); - ASSERT_EQ(WebKit::WebIDBKey::InvalidType, values[0].type()); - ASSERT_EQ(WebKit::WebIDBKey::InvalidType, values[1].type()); + ASSERT_EQ(size_t(4), values.size()); + ASSERT_EQ(WebKit::WebIDBKey::NullType, values[0].type()); + ASSERT_EQ(WebKit::WebIDBKey::NullType, values[1].type()); + ASSERT_EQ(WebKit::WebIDBKey::NullType, values[2].type()); + ASSERT_EQ(WebKit::WebIDBKey::NullType, values[3].type()); } class IDBKeyPathHelper : public UtilityProcessHost::Client { @@ -270,26 +292,44 @@ class ScopedIDBKeyPathHelper { scoped_refptr<IDBKeyPathHelper> key_path_helper_; }; +// Cases: IN_PROC_BROWSER_TEST_F(InProcessBrowserTest, IDBKeyPathExtract) { ScopedIDBKeyPathHelper scoped_helper; const int kId = 7; std::vector<IndexedDBKey> expected_keys; - IndexedDBKey value; - value.SetString(UTF8ToUTF16("zoo")); - expected_keys.push_back(value); + std::vector<content::SerializedScriptValue> serialized_values; - IndexedDBKey invalid_value; - invalid_value.SetInvalid(); - expected_keys.push_back(invalid_value); + IndexedDBKey string_zoo_key; + string_zoo_key.SetString(UTF8ToUTF16("zoo")); + IndexedDBKey null_key; + null_key.SetNull(); + IndexedDBKey invalid_key; + invalid_key.SetInvalid(); - scoped_helper.SetExpectedKeys(kId, expected_keys, false); + // keypath: "foo", value: {foo: "zoo"}, expected: "zoo" + char16 data_foo_zoo[] = {0x0353,0x6f66,0x536f,0x7a03,0x6f6f,0x017b}; + serialized_values.push_back(content::SerializedScriptValue( + false, false, string16(data_foo_zoo, arraysize(data_foo_zoo)))); + expected_keys.push_back(string_zoo_key); - char16 data[] = {0x0353,0x6f66,0x536f,0x7a03,0x6f6f,0x017b}; - std::vector<content::SerializedScriptValue> serialized_values; + // keypath: "foo", value: {foo: null}, expected: invalid + char16 data_foo_null[] = {0x0353, 0x6f66, 0x306f, 0x017b}; serialized_values.push_back(content::SerializedScriptValue( - false, false, string16(data, arraysize(data)))); + false, false, string16(data_foo_null, arraysize(data_foo_null)))); + expected_keys.push_back(invalid_key); + + // keypath: "foo", value: {}, expected: null + char16 data_object[] = {0x017b}; + serialized_values.push_back(content::SerializedScriptValue( + false, false, string16(data_object, arraysize(data_object)))); + expected_keys.push_back(null_key); + + // keypath: "foo", value: null, expected: null serialized_values.push_back( content::SerializedScriptValue(true, false, string16())); + expected_keys.push_back(null_key); + + scoped_helper.SetExpectedKeys(kId, expected_keys, false); scoped_helper.CheckValuesForKeyPath( kId, serialized_values, UTF8ToUTF16("foo")); } @@ -298,19 +338,24 @@ IN_PROC_BROWSER_TEST_F(InProcessBrowserTest, IDBKeyPathPropertyNotAvailable) { ScopedIDBKeyPathHelper scoped_helper; const int kId = 7; std::vector<IndexedDBKey> expected_keys; - IndexedDBKey invalid_value; - invalid_value.SetInvalid(); - expected_keys.push_back(invalid_value); - expected_keys.push_back(invalid_value); + IndexedDBKey null_value; + null_value.SetNull(); + expected_keys.push_back(null_value); + expected_keys.push_back(null_value); scoped_helper.SetExpectedKeys(kId, expected_keys, false); - char16 data[] = {0x0353,0x6f66,0x536f,0x7a03,0x6f6f,0x017b}; std::vector<content::SerializedScriptValue> serialized_values; + // {foo: "zoo", bar: null} + char16 data[] = {0x0353, 0x6f66, 0x536f, 0x7a03, 0x6f6f, 0x0353, 0x6162, + 0x3072, 0x027b}; serialized_values.push_back(content::SerializedScriptValue( false, false, string16(data, arraysize(data)))); + + // null serialized_values.push_back( content::SerializedScriptValue(true, false, string16())); + scoped_helper.CheckValuesForKeyPath(kId, serialized_values, UTF8ToUTF16("PropertyNotAvailable")); } @@ -319,19 +364,25 @@ IN_PROC_BROWSER_TEST_F(InProcessBrowserTest, IDBKeyPathMultipleCalls) { ScopedIDBKeyPathHelper scoped_helper; const int kId = 7; std::vector<IndexedDBKey> expected_keys; - IndexedDBKey invalid_value; - invalid_value.SetInvalid(); - expected_keys.push_back(invalid_value); - expected_keys.push_back(invalid_value); + IndexedDBKey null_value; + null_value.SetNull(); + expected_keys.push_back(null_value); + expected_keys.push_back(null_value); scoped_helper.SetExpectedKeys(kId, expected_keys, true); - char16 data[] = {0x0353,0x6f66,0x536f,0x7a03,0x6f6f,0x017b}; std::vector<content::SerializedScriptValue> serialized_values; + + // {foo: "zoo", bar: null} + char16 data[] = {0x0353, 0x6f66, 0x536f, 0x7a03, 0x6f6f, 0x0353, 0x6162, + 0x3072, 0x027b}; serialized_values.push_back(content::SerializedScriptValue( false, false, string16(data, arraysize(data)))); + + // null serialized_values.push_back( content::SerializedScriptValue(true, false, string16())); + scoped_helper.CheckValuesForKeyPath(kId, serialized_values, UTF8ToUTF16("!+Invalid[KeyPath[[[")); @@ -340,7 +391,7 @@ IN_PROC_BROWSER_TEST_F(InProcessBrowserTest, IDBKeyPathMultipleCalls) { IndexedDBKey value; value.SetString(UTF8ToUTF16("zoo")); expected_keys.push_back(value); - expected_keys.push_back(invalid_value); + expected_keys.push_back(null_value); scoped_helper.SetExpectedKeys(kId + 1, expected_keys, false); scoped_helper.CheckValuesForKeyPath(kId + 1, serialized_values, UTF8ToUTF16("foo")); diff --git a/content/common/indexed_db/indexed_db_key.cc b/content/common/indexed_db/indexed_db_key.cc index 1b9491d..f2a7cfb 100644 --- a/content/common/indexed_db/indexed_db_key.cc +++ b/content/common/indexed_db/indexed_db_key.cc @@ -11,7 +11,7 @@ using WebKit::WebIDBKey; IndexedDBKey::IndexedDBKey() - : type_(WebIDBKey::InvalidType), + : type_(WebIDBKey::NullType), date_(0), number_(0) { } @@ -27,6 +27,10 @@ void IndexedDBKey::SetInvalid() { type_ = WebIDBKey::InvalidType; } +void IndexedDBKey::SetNull() { + type_ = WebIDBKey::NullType; +} + void IndexedDBKey::SetArray(const std::vector<IndexedDBKey>& array) { type_ = WebIDBKey::ArrayType; array_ = array; @@ -72,10 +76,9 @@ IndexedDBKey::operator WebIDBKey() const { case WebIDBKey::NumberType: return WebIDBKey::createNumber(number_); case WebIDBKey::InvalidType: - default: - // TODO(jsbell): Remove "default" label once WebKit bug 76487 has rolled. - // http://crbug.com/110956 return WebIDBKey::createInvalid(); + case WebIDBKey::NullType: + return WebIDBKey::createNull(); } NOTREACHED(); return WebIDBKey::createInvalid(); diff --git a/content/common/indexed_db/indexed_db_key.h b/content/common/indexed_db/indexed_db_key.h index 12b6a53..9414332 100644 --- a/content/common/indexed_db/indexed_db_key.h +++ b/content/common/indexed_db/indexed_db_key.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -19,6 +19,7 @@ class CONTENT_EXPORT IndexedDBKey { explicit IndexedDBKey(const WebKit::WebIDBKey& key); ~IndexedDBKey(); + void SetNull(); void SetInvalid(); void SetArray(const std::vector<IndexedDBKey>& array); void SetString(const string16& string); diff --git a/content/common/indexed_db/indexed_db_param_traits.cc b/content/common/indexed_db/indexed_db_param_traits.cc index af33b1d..34dfde5 100644 --- a/content/common/indexed_db/indexed_db_param_traits.cc +++ b/content/common/indexed_db/indexed_db_param_traits.cc @@ -62,9 +62,7 @@ void ParamTraits<IndexedDBKey>::Write(Message* m, const param_type& p) { WriteParam(m, p.number()); return; case WebKit::WebIDBKey::InvalidType: - default: - // TODO(jsbell): Remove "default" label once WebKit bug 76487 has rolled. - // http://crbug.com/110956 + case WebKit::WebIDBKey::NullType: return; } NOTREACHED(); @@ -111,11 +109,11 @@ bool ParamTraits<IndexedDBKey>::Read(const Message* m, return true; } case WebKit::WebIDBKey::InvalidType: - default: - // TODO(jsbell): Remove "default" label once WebKit bug 76487 has rolled. - // http://crbug.com/110956 r->SetInvalid(); return true; + case WebKit::WebIDBKey::NullType: + r->SetNull(); + return true; } NOTREACHED(); return false; diff --git a/webkit/glue/idb_bindings.cc b/webkit/glue/idb_bindings.cc index ba9f592..b22d2e5 100644 --- a/webkit/glue/idb_bindings.cc +++ b/webkit/glue/idb_bindings.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -25,13 +25,12 @@ bool IDBKeysFromValuesAndKeyPath( std::vector<WebIDBKey>* values) { WebIDBKeyPath web_idb_key_path = WebIDBKeyPath::create(idb_key_path); bool error = web_idb_key_path.parseError() != 0; - // TODO(bulach): what to do when we have a parse error? For now, setting - // all values back as invalid and returning a boolean. + // When a parse error is encountered, no value is returned (null) for (std::vector<WebSerializedScriptValue>::const_iterator i = serialized_script_values.begin(); i != serialized_script_values.end(); ++i) { if (error) { - values->push_back(WebIDBKey::createInvalid()); + values->push_back(WebIDBKey::createNull()); } else { values->push_back( WebIDBKey::createFromValueAndKeyPath(*i, web_idb_key_path)); |