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

Unified Diff: third_party/WebKit/LayoutTests/webexposed/indexeddb-renames-should-not-be-exposed.html

Issue 2276593002: Support renaming of IndexedDB indexes and object stores. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor comment fixes in rename-common.js test code. Created 4 years, 3 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: third_party/WebKit/LayoutTests/webexposed/indexeddb-renames-should-not-be-exposed.html
diff --git a/third_party/WebKit/LayoutTests/webexposed/indexeddb-renames-should-not-be-exposed.html b/third_party/WebKit/LayoutTests/webexposed/indexeddb-renames-should-not-be-exposed.html
new file mode 100644
index 0000000000000000000000000000000000000000..46d35a14d4d8285045d29309c55c5dceabf5eea3
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/webexposed/indexeddb-renames-should-not-be-exposed.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<script src='../resources/testharness.js'></script>
+<script src='../resources/testharnessreport.js'></script>
+<script>
+
+// This test makes sure that the IndexedDB object store and index name setters
+// are only exposed when the experimental Web Platform features flag is set.
+// This is implemented in Blink because our bindings generator does not support
+// separate settings for exposing a property's getter and setter.
+//
+// TODO(crbug.com/644889): Remove this test after we ship IndexedDB v2.
+
+async_test(testCase => {
foolip 2016/09/09 08:12:17 FWIW, in upstream web-platform-tests, this seems t
pwnall 2016/09/09 20:50:34 Done. I used t, though it doesn't mesh well with
foolip 2016/09/09 22:31:17 Right, so it wouldn't work to use only arrow funct
+ const dbName = 'db' + self.location.pathname + '-' + testCase.name;
foolip 2016/09/09 08:12:17 Looks like the web platform is missing an mktemp f
pwnall 2016/09/09 20:50:34 What it really needs is a makeAllMyTestsPass() :D
foolip 2016/09/09 22:31:17 Acknowledged.
+ indexedDB.deleteDatabase(dbName);
+ const request = indexedDB.open(dbName, 1);
+ request.onupgradeneeded = testCase.step_func(event => {
+ const database = event.target.result;
+ const transaction = event.target.transaction;
+ const store = database.createObjectStore('books');
+ store.name = 'renamed_books';
+ assert_equals(
+ store.name, 'books',
+ 'IndexedDB object store renaming should not be web-exposed');
+ const authorIndex = store.createIndex('by_author', 'author');
+ authorIndex.name = 'renamed_by_author';
+ assert_equals(
+ authorIndex.name, 'by_author',
+ 'IndexedDB object store renaming should not be web-exposed');
+ });
+ request.onsuccess = event => {
foolip 2016/09/09 08:12:17 testCase.step_func, or even step_func_done if you
pwnall 2016/09/09 20:50:34 Done.
+ const database = event.target.result;
+ database.close();
+ testCase.done();
+ };
+ request.onerror = testCase.unreached_func(
+ 'The IndexedDB request should not receive an error event');
+}, 'IndexedDB object store and index renaming should not be web-exposed\nThis test is expected to fail in LayoutTests/webexposed');
+</script>

Powered by Google App Engine
This is Rietveld 408576698