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

Unified Diff: chrome/test/data/extensions/platform_apps/web_view/load_webview_accessible_resource/embedder.js

Issue 1312653003: Fix for WebView accessible resources. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Small fix. Rebased. Created 5 years, 3 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
Index: chrome/test/data/extensions/platform_apps/web_view/load_webview_accessible_resource/embedder.js
diff --git a/chrome/test/data/extensions/platform_apps/web_view/load_webview_accessible_resource/embedder.js b/chrome/test/data/extensions/platform_apps/web_view/load_webview_accessible_resource/embedder.js
new file mode 100644
index 0000000000000000000000000000000000000000..5ba391dcb96fcff6bbb2dbad503394b450fe3463
--- /dev/null
+++ b/chrome/test/data/extensions/platform_apps/web_view/load_webview_accessible_resource/embedder.js
@@ -0,0 +1,43 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var embedder = {};
+embedder.guestURL = '';
+
+window.runTest = function(testName) {
+ if (testName == 'testLoadWebviewAccessibleResource') {
+ testLoadWebviewAccessibleResource();
+ } else {
+ window.console.log('Incorrect testName: ' + testName);
+ chrome.test.sendMessage('TEST_FAILED');
+ }
+}
+
+function testLoadWebviewAccessibleResource() {
+ var webview = document.querySelector('webview');
+
+ webview.addEventListener('loadstop', function() {
+ webview.executeScript(
+ {code: "document.querySelector('img').naturalWidth"}, function(result) {
+ // If the test image loads successfully, it will have a |naturalWidth|
+ // of 17, and the test passes.
+ if (result[0] == 17)
+ chrome.test.sendMessage('TEST_PASSED');
+ else
+ chrome.test.sendMessage('TEST_FAILED');
+ });
+ });
+
+ webview.src = embedder.guestURL;
+};
+
+onload = function() {
+ chrome.test.getConfig(function(config) {
+ embedder.guestURL =
+ 'http://localhost:' + config.testServer.port +
+ '/extensions/platform_apps/web_view/load_webview_accessible_resource/' +
+ 'guest.html';
+ chrome.test.sendMessage('Launched');
+ });
+};

Powered by Google App Engine
This is Rietveld 408576698