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

Unified Diff: content/test/data/simple_links.html

Issue 715203004: PlzNavigate: Add a browser test for basic navigations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a browser test for renderer initiated navigations Created 6 years, 1 month 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: content/test/data/simple_links.html
diff --git a/content/test/data/simple_links.html b/content/test/data/simple_links.html
new file mode 100644
index 0000000000000000000000000000000000000000..04019ff98187575808c1158851322d39eb0c61b4
--- /dev/null
+++ b/content/test/data/simple_links.html
@@ -0,0 +1,54 @@
+<html>
+
+ <head><title>Simple links</title>
+ <script>
+ function simulateClick(target) {
+ var evt = document.createEvent("MouseEvents");
+ evt.initMouseEvent("click", true, true, window,
+ 0, 0, 0, 0, 0, false, false,
+ false, false, 0, null);
+
+ return target.dispatchEvent(evt);
+ }
+
+ function clickSameSiteLink() {
+ return simulateClick(document.getElementById("same_site_link"));
+ }
+
+ function clickCrossSiteLink() {
+ return simulateClick(
+ document.getElementById("cross_site_link"));
+ }
+
+ // Listen to incoming messages and reply to them.
nasko 2014/11/24 23:15:00 Is any of this code that follows actually used? If
clamy 2014/11/26 12:47:43 Done.
+ var receivedMessages = 0;
+ window.addEventListener("message", messageReceived, false);
+ function messageReceived(event) {
+ receivedMessages++;
+ event.source.postMessage(event.data, "*");
+ }
+
+ // Send a message which contains a message port.
+ var mc;
+ function postWithPortToFoo() {
+ mc = new MessageChannel();
+ mc.port1.onmessage = portMessageReceived;
+ mc.port1.start();
+ var w = window.open("", "foo");
+ w.postMessage({message: "msg-with-port", port: mc.port2}, "*", [mc.port2]);
+ return true;
+ }
+
+ var receivedMessagesViaPort = 0;
+ function portMessageReceived(event) {
+ receivedMessagesViaPort++;
+ // Change the title to generate a notification.
+ document.title = event.data;
+ }
+ </script>
+ </head>
+
+<a href="title2.html" id="same_site_link">same-site</a><br>
+<a href="http://foo.com/title2.html" id="cross_site_link">cross-site</a><br>
+
+</html>

Powered by Google App Engine
This is Rietveld 408576698