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

Side by Side Diff: chrome/test/data/extensions/platform_apps/web_view/common/cleardata_persistent/bootstrap.js

Issue 2700473003: Support the removal of only session cookies or persistent cookies (Closed)
Patch Set: adding comment 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
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 config.IS_CHROME_TEST = true;
6 // Guest served from TestServer.
7 config.IS_JS_ONLY_GUEST = false;
8 config.TEST_DIR = 'cleardata_persistent';
9
10 var clearDataTests = {};
11
12 // step1. Ask guest to load load session (bar) and persistent (foo) cookies.
13 // step2. Guest responds saying it has added cookies.
14 // embedder clears persistent cookie data of the guest via clearData API.
15 // step3. Ask guest for cookies that were set in step1.
16 // step4. Guest responds with cookie values, embedder verifies persistent cookie
17 // is unset but session cookie is still set.
18
19 var run = function() {
20 var container = document.createElement('div');
21 container.id = 'webview-tag-container';
22 document.body.appendChild(container);
23
24 chrome.test.getConfig(function(chromeConfig) {
25 window.console.log('getConfig: ' + chromeConfig);
26 utils.setUp(chromeConfig, config);
27 embedder.loadGuest(function() {
28 chrome.test.runTests([
29 clearDataTests.testCookies
30 ]);
31 }, function(data) {
32 var handled = true;
33 switch (data[0]) {
34 case 'step2.cookies-added':
35 window.console.log('embedder, on message: ' + data[0]);
36 var onDataCleared = function() {
37 window.console.log('embedder.onDataCleared');
38 embedder.webview.contentWindow.postMessage(
39 JSON.stringify(['step3.get-cookies', 'foo', 'bar']), '*');
40 };
41 embedder.webview.clearData(
42 { 'since': 1 }, { 'persistentCookies': true },
43 onDataCleared);
44 break;
45 case 'step4.got-cookies':
46 window.console.log('embedder, on message: ' + data[0]);
47 var cookies = data[1];
48 // fooValue was a persistent cookie, which should be gone.
49 chrome.test.assertEq([null, 'barValue'], cookies);
50 chrome.test.succeed();
51 break;
52 default:
53 handled = false;
54 break;
55 }
56 return handled;
57 });
58 });
59 };
60
61 // Tests.
62 clearDataTests.testCookies = function testCookies() {
63 window.console.log('clearDataTests.testCookies');
64 embedder.webview.contentWindow.postMessage(
65 JSON.stringify(['step1.add-cookies']), '*');
66 };
67
68 // Run test(s).
69 run();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698