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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/webstorage/event_no_duplicates.html

Issue 2697953002: Remove incorrect optimization in LevelDBWrapperImpl::DeleteAll(). (Closed)
Patch Set: fix web platform test Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/external/wpt/MANIFEST.json ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE HTML>
2 <html>
3 <title>WebStorage Test: StorageEvent - only if something changes</title>
4 <script src="/resources/testharness.js"></script>
5 <script src="/resources/testharnessreport.js"></script>
6 <body>
7 <script>
8 const iframe = document.createElement('iframe');
9
10 function tests(storageName) {
11 test(t => assert_true(storageName in window), storageName + ' exists');
12
13 const storage = window[storageName];
14 const iframeStorage = iframe.contentWindow[storageName];
15
16 add_completion_callback(() => {
17 storage.clear();
18 });
19
20 promise_test(t => {
21 const w = new EventWatcher(t, iframe.contentWindow, 'storage');
22
23 // Random key to make sure we don't conflict with any cruft leftover from
24 // earlier runs. Any synchronization would be really hard with localStorage
25 // limited guarantees.
26 const testKey = Math.random().toString(36).slice(2);
27
28 storage.setItem(testKey, 'foo');
29 storage.setItem(testKey, 'foo');
30 storage.setItem(testKey, 'bar');
31 return w.wait_for('storage')
32 .then(e => {
33 assert_equals(e.storageArea, iframeStorage);
34 assert_equals(e.key, testKey);
35 assert_equals(e.newValue, 'foo');
36 return w.wait_for('storage');
37 })
38 .then(e => {
39 assert_equals(e.storageArea, iframeStorage);
40 assert_equals(e.key, testKey);
41 assert_equals(e.oldValue, 'foo');
42 assert_equals(e.newValue, 'bar');
43 });
44 }, 'Setting to same value does not trigger event for ' + storageName);
45
46 promise_test(t => {
47 const w = new EventWatcher(t, iframe.contentWindow, 'storage');
48
49 // Random key to make sure we don't conflict with any cruft leftover from
50 // earlier runs. Any synchronization would be really hard with localStorage
51 // limited guarantees.
52 const testKey1 = Math.random().toString(36).slice(2);
53 const testKey2 = Math.random().toString(36).slice(2);
54
55 storage.removeItem(testKey1);
56 storage.setItem(testKey2, 'foo');
57 return w.wait_for('storage')
58 .then(e => {
59 assert_equals(e.storageArea, iframeStorage);
60 assert_equals(e.key, testKey2);
61 assert_equals(e.newValue, 'foo');
62 });
63 }, 'Deleting non-existent key does not trigger event for ' + storageName);
64
65
66 promise_test(t => {
67 const w = new EventWatcher(t, iframe.contentWindow, 'storage');
68
69 // Random key to make sure we don't conflict with any cruft leftover from
70 // earlier runs. Any synchronization would be really hard with localStorage
71 // limited guarantees.
72 const testKey = Math.random().toString(36).slice(2);
73
74 storage.setItem(testKey, 'foo');
75 storage.clear();
76 storage.clear();
77 storage.setItem(testKey, 'bar');
78 return w.wait_for('storage')
79 .then(e => {
80 assert_equals(e.storageArea, iframeStorage);
81 assert_equals(e.key, testKey);
82 assert_equals(e.newValue, 'foo');
83 return w.wait_for('storage');
84 })
85 .then(e => {
86 assert_equals(e.storageArea, iframeStorage);
87 assert_equals(e.key, null);
88 assert_equals(e.oldValue, null);
89 assert_equals(e.newValue, null);
90 return w.wait_for('storage');
91 })
92 .then(e => {
93 assert_equals(e.storageArea, iframeStorage);
94 assert_equals(e.key, testKey);
95 assert_equals(e.oldValue, null);
96 assert_equals(e.newValue, 'bar');
97 });
98 }, 'Clearing empty storage does not trigger event for ' + storageName);
99
100 }
101
102 iframe.onload = () => {
103 tests('sessionStorage');
104 tests('localStorage');
105 };
106 iframe.src = 'about:blank';
107 document.body.appendChild(iframe);
108 </script>
109 </body>
110 </html>
111
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/external/wpt/MANIFEST.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698