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

Unified Diff: extensions/test/data/web_view/apitest/main.js

Issue 2646423003: Fix regression of webview loadstart events firing for same page navigations.
Patch Set: Created 3 years, 11 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
« no previous file with comments | « extensions/test/data/web_view/apitest/guest_same_page_navigation.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/test/data/web_view/apitest/main.js
diff --git a/extensions/test/data/web_view/apitest/main.js b/extensions/test/data/web_view/apitest/main.js
index 339be1b130a80ac41c9db10a1519ca2ecff8d7c0..65228da0dcb45e80631b96ac61c7cf1d3dc8a766 100644
--- a/extensions/test/data/web_view/apitest/main.js
+++ b/extensions/test/data/web_view/apitest/main.js
@@ -19,6 +19,8 @@ embedder.setUp_ = function(config) {
embedder.redirectGuestURLDest =
embedder.baseGuestURL + '/guest_redirect.html';
embedder.windowOpenGuestURL = embedder.baseGuestURL + '/guest.html';
+ embedder.samePageNavigationURL =
+ embedder.baseGuestURL + '/guest_same_page_navigation.html';
};
window.runTest = function(testName) {
@@ -1050,6 +1052,28 @@ function testLoadAbortNonWebSafeScheme() {
document.body.appendChild(webview);
};
+// This test verifies that the loadStart isn't sent for same page navigations,
+// while loadCommit is (per docs).
+function testLoadEventsSamePageNavigation() {
+ var webview = new WebView();
+ var loadStartCount = 0;
+ var loadCommitCount = 0;
+ webview.addEventListener('loadstart', function(evt) {
+ loadStartCount++;
+ });
+ webview.addEventListener('loadcommit', function(e) {
+ loadCommitCount++;
+ });
+ webview.addEventListener('loadstop', function(evt) {
+ embedder.test.assertEq(1, loadStartCount);
+ embedder.test.assertEq(2, loadCommitCount);
+ embedder.test.succeed();
+ });
+
+ webview.src = embedder.samePageNavigationURL;
+ document.body.appendChild(webview);
+}
+
// Tests that the 'loadprogress' event is triggered correctly.
function testLoadProgressEvent() {
var webview = document.createElement('webview');
@@ -1756,6 +1780,7 @@ embedder.test.testList = {
'testLoadAbortIllegalJavaScriptURL': testLoadAbortIllegalJavaScriptURL,
'testLoadAbortInvalidNavigation': testLoadAbortInvalidNavigation,
'testLoadAbortNonWebSafeScheme': testLoadAbortNonWebSafeScheme,
+ 'testLoadEventsSamePageNavigation': testLoadEventsSamePageNavigation,
'testLoadProgressEvent': testLoadProgressEvent,
'testLoadStartLoadRedirect': testLoadStartLoadRedirect,
'testNavigateAfterResize': testNavigateAfterResize,
« no previous file with comments | « extensions/test/data/web_view/apitest/guest_same_page_navigation.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698