diff --git a/lgpl/sources/chromium/src/chrome/test/data/android/subresource_filter/page-with-img.html b/lgpl/sources/chromium/src/chrome/test/data/android/subresource_filter/page-with-img.html
new file mode 100644
index 0000000000..00bfe565e8
--- /dev/null
+++ b/lgpl/sources/chromium/src/chrome/test/data/android/subresource_filter/page-with-img.html
@@ -0,0 +1,7 @@
+
+
+
diff --git a/lgpl/sources/chromium/src/chrome/test/data/android/test.mht b/lgpl/sources/chromium/src/chrome/test/data/android/test.mht
new file mode 100644
index 0000000000..a57f6ec5a4
--- /dev/null
+++ b/lgpl/sources/chromium/src/chrome/test/data/android/test.mht
@@ -0,0 +1,17 @@
+From:
+Subject: Test
+Date: Mon, Nov 21 2011 10:59:06 GMT-0800
+MIME-Version: 1.0
+Content-Type: multipart/related;
+ boundary="----=_NextPart_000_0000_0324C3DC.A3C79392";
+ type="text/html"
+
+------=_NextPart_000_0000_0324C3DC.A3C79392
+Content-Type: text/html; charset="UTF-8"
+Content-Transfer-Encoding: quoted-printable
+Content-Location: http://www.example.com
+
+
+Welcome!
+
+------=_NextPart_000_0000_0324C3DC.A3C79392--
diff --git a/lgpl/sources/chromium/src/chrome/test/data/autofill/label_change.html b/lgpl/sources/chromium/src/chrome/test/data/autofill/label_change.html
new file mode 100644
index 0000000000..0e03710238
--- /dev/null
+++ b/lgpl/sources/chromium/src/chrome/test/data/autofill/label_change.html
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/lgpl/sources/chromium/src/chrome/test/data/banners/main.js b/lgpl/sources/chromium/src/chrome/test/data/banners/main.js
index 1cc2aa902e..c0e1ee0033 100644
--- a/lgpl/sources/chromium/src/chrome/test/data/banners/main.js
+++ b/lgpl/sources/chromium/src/chrome/test/data/banners/main.js
@@ -2,19 +2,92 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-function initialize() {
- navigator.serviceWorker.register('service_worker.js');
+const Action = {
+ VERIFY_APPINSTALLED: "verify_appinstalled",
+ VERIFY_PROMPT_APPINSTALLED: "verify_prompt_appinstalled",
+ VERIFY_BEFOREINSTALLPROMPT: "verify_beforeinstallprompt",
+ CALL_PROMPT_DELAYED: "call_prompt_delayed",
+ CALL_PROMPT_IN_HANDLER: "call_prompt_in_handler",
+ CALL_PROMPT_NO_USERCHOICE: "call_prompt_no_userchoice",
+ CANCEL_PROMPT_AND_NAVIGATE: "cancel_prompt_and_navigate",
+ CANCEL_PROMPT: "cancel_prompt",
+ STASH_EVENT: "stash_event",
+};
+
+const LISTENER = "listener";
+const ATTR = "attr";
+
+// These blanks will get filled in when each event comes through.
+let gotEventsFrom = ['_'.repeat(LISTENER.length), '_'.repeat(ATTR.length)];
+
+let stashedEvent = null;
+
+function startWorker(worker) {
+ navigator.serviceWorker.register(worker);
+}
- window.addEventListener('appinstalled', () => {
- window.document.title = 'Got appinstalled';
+function verifyEvents(eventName) {
+ function setTitle() {
+ window.document.title = 'Got ' + eventName + ': ' +
+ gotEventsFrom.join(', ');
+ }
+
+ window.addEventListener(eventName, () => {
+ gotEventsFrom[0] = LISTENER;
+ setTitle();
+ });
+ window['on' + eventName] = () => {
+ gotEventsFrom[1] = ATTR;
+ setTitle();
+ };
+}
+
+function callPrompt(event) {
+ event.prompt();
+ event.userChoice.then(function(choiceResult) {
+ window.document.title = 'Got userChoice: ' + choiceResult.outcome;
+ });
+}
+
+function callStashedPrompt() {
+ if (stashedEvent === null) {
+ throw new Error('No event was previously stashed');
+ }
+ stashedEvent.prompt();
+}
+
+function addPromptListener(action) {
+ window.addEventListener('beforeinstallprompt', function(e) {
+ e.preventDefault();
+
+ switch (action) {
+ case Action.CALL_PROMPT_DELAYED:
+ setTimeout(callPrompt, 0, e);
+ break;
+ case Action.CALL_PROMPT_IN_HANDLER:
+ callPrompt(e);
+ break;
+ case Action.CALL_PROMPT_NO_USERCHOICE:
+ setTimeout(() => e.prompt(), 0);
+ break;
+ case Action.CANCEL_PROMPT_AND_NAVIGATE:
+ // Navigate the window to trigger cancellation in the renderer.
+ window.location.href = "/";
+ break;
+ case Action.STASH_EVENT:
+ stashedEvent = e;
+ break;
+ }
});
}
function addManifestLinkTag() {
- var url = window.location.href;
- var manifestIndex = url.indexOf("?manifest=");
- var manifestUrl =
- (manifestIndex >= 0) ? url.slice(manifestIndex + 10) : 'manifest.json';
+ const url = new URL(window.location.href);
+ let manifestUrl = url.searchParams.get('manifest');
+ if (!manifestUrl) {
+ manifestUrl = 'manifest.json';
+ }
+
var linkTag = document.createElement("link");
linkTag.id = "manifest";
linkTag.rel = "manifest";
@@ -22,6 +95,42 @@ function addManifestLinkTag() {
document.head.append(linkTag);
}
+function initialize() {
+ const url = new URL(window.location.href);
+ const action = url.searchParams.get('action');
+ if (!action) {
+ return;
+ }
+
+ switch (action) {
+ case Action.VERIFY_APPINSTALLED:
+ verifyEvents('appinstalled');
+ break;
+ case Action.VERIFY_PROMPT_APPINSTALLED:
+ addPromptListener(Action.CALL_PROMPT_NO_USERCHOICE);
+ verifyEvents('appinstalled');
+ break;
+ case Action.VERIFY_BEFOREINSTALLPROMPT:
+ verifyEvents('beforeinstallprompt');
+ break;
+ case Action.CALL_PROMPT_DELAYED:
+ case Action.CALL_PROMPT_IN_HANDLER:
+ case Action.CALL_PROMPT_NO_USERCHOICE:
+ case Action.CANCEL_PROMPT_AND_NAVIGATE:
+ case Action.CANCEL_PROMPT:
+ case Action.STASH_EVENT:
+ addPromptListener(action);
+ break;
+ default:
+ throw new Error("Unrecognised action: " + action);
+ }
+}
+
+function initializeWithWorker(worker) {
+ startWorker(worker);
+ initialize();
+}
+
function changeManifestUrl(newManifestUrl) {
var linkTag = document.getElementById("manifest");
linkTag.href = newManifestUrl;
diff --git a/lgpl/sources/chromium/src/chrome/test/data/banners/manifest_no_service_worker.html b/lgpl/sources/chromium/src/chrome/test/data/banners/manifest_no_service_worker.html
index 6db2a5fb36..a8f23d40cf 100644
--- a/lgpl/sources/chromium/src/chrome/test/data/banners/manifest_no_service_worker.html
+++ b/lgpl/sources/chromium/src/chrome/test/data/banners/manifest_no_service_worker.html
@@ -1,9 +1,15 @@
Web app banner test page
-
+
+
-
+
Do-nothing page with a manifest but no service worker.
diff --git a/lgpl/sources/chromium/src/chrome/test/data/banners/manifest_test_page.html b/lgpl/sources/chromium/src/chrome/test/data/banners/manifest_test_page.html
index 2bf79dc205..1897fbafd5 100644
--- a/lgpl/sources/chromium/src/chrome/test/data/banners/manifest_test_page.html
+++ b/lgpl/sources/chromium/src/chrome/test/data/banners/manifest_test_page.html
@@ -9,7 +9,7 @@
addManifestLinkTag();
-
- Do-nothing page with a service worker.
+
+ Do-nothing page with a manifest and a service worker.
diff --git a/lgpl/sources/chromium/src/chrome/test/data/banners/no_manifest_test_page.html b/lgpl/sources/chromium/src/chrome/test/data/banners/no_manifest_test_page.html
index 3d4e8d701c..16a505cf9d 100644
--- a/lgpl/sources/chromium/src/chrome/test/data/banners/no_manifest_test_page.html
+++ b/lgpl/sources/chromium/src/chrome/test/data/banners/no_manifest_test_page.html
@@ -3,7 +3,10 @@
Web app banner test page
-
- Do-nothing page with a service worker, but no manifest.
+
+
+ Do-nothing page with a service worker, but no manifest.
-
\ No newline at end of file
+