Chromium Code Reviews| Index: chrome/test/data/extensions/platform_apps/ad_view/loadabort_event/chrometest.js |
| diff --git a/chrome/test/data/extensions/platform_apps/ad_view/loadabort_event/chrometest.js b/chrome/test/data/extensions/platform_apps/ad_view/loadabort_event/chrometest.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..732709d5483ac1dfcf018cabb26be0794a33d0ea |
| --- /dev/null |
| +++ b/chrome/test/data/extensions/platform_apps/ad_view/loadabort_event/chrometest.js |
| @@ -0,0 +1,32 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
|
benwells
2013/04/03 02:40:03
Nit: no (c). Please make sure they are all gone in
rpaquay
2013/04/03 18:30:05
Done.
As an aside, in general, how does one keep
benwells
2013/04/04 04:33:52
Hmmm, you can read chromium-dev I guess. I found o
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +// This test checks the "loadabort" event is called when the "src" attribute |
| +// of an <adview> is an invalid URL. |
| + |
| +function runTests(guestURL) { |
| + chrome.test.runTests([ |
| + function test() { |
| + var adview = document.getElementsByTagName("adview")[0]; |
| + |
| + adview.addEventListener("loadabort", function(event) { |
| + var url = event.url; |
| + var isTopLevel = event.isTopLevel; |
| + chrome.test.assertEq(guestURL, url); |
| + chrome.test.assertEq(true, isTopLevel); |
| + console.log("loadabort event called: url=" + url); |
| + chrome.test.succeed(); |
| + }) |
| + |
| + adview.setAttribute("src", guestURL); |
| + } |
| + ]); |
| +} |
| + |
| +window.onload = function() { |
| + chrome.test.getConfig(function(config) { |
| + var guestURL = 'http://255.255.255.255/fake_file.html'; |
| + runTests(guestURL); |
| + }); |
| +} |