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

Unified Diff: chrome/test/data/extensions/platform_apps/web_view/shim/main.js

Issue 307543005: Fix the Declarative WebRequest API for <webview> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_webcontentsdelegate_impl_to_chrome
Patch Set: Fix WebRequest unit tests Created 6 years, 7 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 | « chrome/renderer/resources/extensions/web_view_experimental.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/platform_apps/web_view/shim/main.js
diff --git a/chrome/test/data/extensions/platform_apps/web_view/shim/main.js b/chrome/test/data/extensions/platform_apps/web_view/shim/main.js
index da33baca2e1bf14f59da153d7aeeb430a6a6def0..fdc08a68871fa997184ba67d2074aaa8828a1de7 100644
--- a/chrome/test/data/extensions/platform_apps/web_view/shim/main.js
+++ b/chrome/test/data/extensions/platform_apps/web_view/shim/main.js
@@ -984,7 +984,7 @@ function testDeclarativeWebRequestAPI() {
webview.request.onRequest.removeRules();
webview.reload();
});
- webview.addEventListener('loadcommit', function(e) {
+ webview.addEventListener('loadstop', function(e) {
embedder.test.assertEq(2, step);
embedder.test.succeed();
});
@@ -992,6 +992,30 @@ function testDeclarativeWebRequestAPI() {
document.body.appendChild(webview);
}
+function testDeclarativeWebRequestAPISendMessage() {
+ var webview = new WebView();
+ window.console.log(embedder.emptyGuestURL);
+ var rule = {
+ conditions: [
+ new chrome.webViewRequest.RequestMatcher(
+ {
+ url: { urlContains: 'guest' }
+ }
+ )
+ ],
+ actions: [
+ new chrome.webViewRequest.SendMessageToExtension({ message: 'bleep' })
+ ]
+ };
+ webview.request.onRequest.addRules([rule]);
+ webview.request.onMessage.addListener(function(e) {
+ embedder.test.assertEq('bleep', e.message);
+ embedder.test.succeed();
+ });
+ webview.src = embedder.emptyGuestURL;
+ document.body.appendChild(webview);
+}
+
// This test verifies that the WebRequest API onBeforeRequest event fires on
// clients*.google.com URLs.
function testWebRequestAPIGoogleProperty() {
@@ -1679,6 +1703,8 @@ embedder.test.testList = {
'testNewWindowNoReferrerLink': testNewWindowNoReferrerLink,
'testContentLoadEvent': testContentLoadEvent,
'testDeclarativeWebRequestAPI': testDeclarativeWebRequestAPI,
+ 'testDeclarativeWebRequestAPISendMessage':
+ testDeclarativeWebRequestAPISendMessage,
'testWebRequestAPI': testWebRequestAPI,
'testWebRequestAPIGoogleProperty': testWebRequestAPIGoogleProperty,
'testWebRequestListenerSurvivesReparenting':
« no previous file with comments | « chrome/renderer/resources/extensions/web_view_experimental.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698