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

Unified Diff: chrome/test/data/extensions/platform_apps/ad_view/flag_required/chrometest.js

Issue 12967016: Improve <adview> implementation and add tests. (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Code review feedback. Created 7 years, 9 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/ad_view/flag_required/chrometest.js
diff --git a/chrome/test/data/extensions/platform_apps/ad_view/flag_required/chrometest.js b/chrome/test/data/extensions/platform_apps/ad_view/flag_required/chrometest.js
new file mode 100644
index 0000000000000000000000000000000000000000..7a7e746463bf32c22961a66402cb3b3415f6f37d
--- /dev/null
+++ b/chrome/test/data/extensions/platform_apps/ad_view/flag_required/chrometest.js
@@ -0,0 +1,45 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
benwells 2013/04/03 02:40:03 Nit: no (c)
rpaquay 2013/04/03 18:30:05 Done.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This test checks an <adview> element has no behavior when the "kEnableAdview"
+// flag is missing.
+
+function runTests() {
+ chrome.test.runTests([
+ function test() {
+ var adview = document.getElementsByTagName("adview")[0];
+ adview.addEventListener("loadcommit", function() {
+ chrome.test.fail('Ad network should not be loaded if adview command ' +
+ 'line flag is not set.');
+ })
+
+ adview.addEventListener("loadabort", function() {
+ chrome.test.fail('Ad network should not be loaded if adview command ' +
+ 'line flag is not set.');
+ })
+
+ // Note: Assertions have to occur in a callback function because of the
+ // way mutation events are processed. See
+ // http://lists.w3.org/Archives/Public/public-webapps/2011JulSep/1622.html
+ setTimeout(function() {
+ chrome.test.assertEq(undefined, adview['src']);
+ chrome.test.assertEq(undefined, adview['ad-network']);
+ chrome.test.assertEq(undefined, adview['name']);
+
+ chrome.test.assertEq(false, adview.hasAttribute('src'));
+ chrome.test.assertEq(true, adview.hasAttribute('ad-network'));
benwells 2013/04/03 02:40:03 Why is this expected to be true?
rpaquay 2013/04/03 18:30:05 Because there is a value for the "ad-network" attr
benwells 2013/04/04 04:33:52 Nit: please add a comment to explain why the ad-ne
rpaquay 2013/04/05 16:12:08 Done.
+ chrome.test.assertEq(false, adview.hasAttribute('name'));
+
+ console.log("Properties and attributes are inactive.");
+ chrome.test.succeed();
+ }, 0);
+ }
benwells 2013/04/03 02:40:03 Shouldn't there be a line like adview.setAttribute
rpaquay 2013/04/03 18:30:05 See comment above.
benwells 2013/04/04 04:33:52 OK. There is now a line like adview.setAttribute,
+ ]);
+}
+
+window.onload = function() {
+ chrome.test.getConfig(function(config) {
+ runTests();
+ });
+}

Powered by Google App Engine
This is Rietveld 408576698