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

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

Issue 12051090: Move all <webview> tests to web_view directory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with ToT Created 7 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
Index: chrome/test/data/extensions/platform_apps/web_view_src_attribute/main.js
diff --git a/chrome/test/data/extensions/platform_apps/web_view_src_attribute/main.js b/chrome/test/data/extensions/platform_apps/web_view_src_attribute/main.js
deleted file mode 100644
index d2d696c500ce50da215b29c31748aeab67dd703a..0000000000000000000000000000000000000000
--- a/chrome/test/data/extensions/platform_apps/web_view_src_attribute/main.js
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright (c) 2012 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 checkSrc = function(element, expectedValue) {
- // Note that element.getAttribute('src') should not be used, it can be out of
- // sync with element.src.
- chrome.test.assertEq(expectedValue, element.src);
-};
-
-onload = function() {
- chrome.test.runTests([
- function webView() {
- var expectedSrcOne = 'data:text/html,<body>One</body>';
- var expectedSrcTwo = 'data:text/html,<body>Two</body>';
- var expectedSrcThree = 'data:text/html,<body>Three</body>';
-
- var step = 1;
- // For setting src, we check if both webview.setAttribute('src', ?);
- // and webview.src = ?; works properly.
- var webview = document.querySelector('webview');
-
- var runStep2 = function() {
- step = 2;
- chrome.test.log('run step: ' + step);
- // Check if initial src is set correctly.
- checkSrc(webview, expectedSrcOne);
- webview.setAttribute('src', expectedSrcTwo);
- };
-
- var runStep3 = function() {
- step = 3;
- chrome.test.log('run step: ' + step);
- // Expect the src change to be reflected.
- checkSrc(webview, expectedSrcTwo);
- // Set src attribute directly on the element.
- webview.src = expectedSrcThree;
- };
-
- var runStep4 = function() {
- step = 4;
- chrome.test.log('run step: ' + step);
- // Expect the src change to be reflected.
- checkSrc(webview, expectedSrcThree);
- // Set empty src, this will be ignored.
- webview.setAttribute('src', '');
-
- setTimeout(function() {
- // Expect empty src to be ignored.
- checkSrc(webview, expectedSrcThree);
- // Set empty src again, directly changing the src attribute.
- webview.src = '';
-
- setTimeout(function() {
- // Expect empty src to be ignored.
- checkSrc(webview, expectedSrcThree);
- chrome.test.succeed();
- }, 0);
- }, 0);
- };
-
- // Wait for navigation to complete before checking src attribute.
- webview.addEventListener('loadcommit', function(e) {
- switch (step) {
- case 1:
- runStep2();
- break;
- case 2:
- runStep3();
- break;
- case 3:
- runStep4();
- break;
- default:
- // Unchecked.
- chrome.test.fail('Unexpected step: ' + step + ' with url: ' +
- e.url);
- }
- });
- }
- ]);
-};

Powered by Google App Engine
This is Rietveld 408576698