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

Unified Diff: chrome/test/data/extensions/api_test/mutation_observers/background.js

Issue 9969178: Added browsertest to assert that extension API calls are counted as V8RecursionScopes and delay mic… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fixed date Created 8 years, 8 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/chrome_tests.gypi ('k') | chrome/test/data/extensions/api_test/mutation_observers/manifest.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/api_test/mutation_observers/background.js
diff --git a/chrome/test/data/extensions/api_test/mutation_observers/background.js b/chrome/test/data/extensions/api_test/mutation_observers/background.js
new file mode 100644
index 0000000000000000000000000000000000000000..5aa1454f1be6264c5a6a8d11ae5edc3acf6fb997
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/mutation_observers/background.js
@@ -0,0 +1,37 @@
+// 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.
+
+window.addEventListener('DOMContentLoaded', function() {
+ var body = document.body;
+ var div = body.appendChild(document.createElement('div'));
+ var input1 = body.appendChild(document.createElement('input'));
+ var input2 = body.appendChild(document.createElement('input'));
+
+ input1.focus();
+ input1.addEventListener('blur', function() {
+ div.setAttribute('baz', 'bat');
+ });
+
+ var success = false;
+ var mutationsDelivered = false;
+
+ var MutationObserver = MutationObserver || WebKitMutationObserver;
+ var observer = new MutationObserver(function() {
+ mutationsDelivered = true;
+ if (success)
+ chrome.test.succeed();
+ });
+ observer.observe(document, { subtree: true, attributes: true });
+
+ // The getAll callback should be counted as a V8RecursionScope and cause
+ // the delivery of MutationRecords to be delayed until it has exited.
+ chrome.windows.getAll(function() {
+ div.setAttribute('foo', 'bar');
+ input2.focus();
+ if (mutationsDelivered)
+ chrome.test.fail();
+ else
+ success = true;
+ });
+});
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/test/data/extensions/api_test/mutation_observers/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698