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

Unified Diff: chrome/browser/resources/bookmark_manager/js/bmm_test.html

Issue 681303005: Make bookmark manager load tests work again. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: asdf Created 6 years, 2 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 | « no previous file | chrome/browser/resources/chromeos/login/screen_context_test.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/bookmark_manager/js/bmm_test.html
diff --git a/chrome/browser/resources/bookmark_manager/js/bmm_test.html b/chrome/browser/resources/bookmark_manager/js/bmm_test.html
index d74c88d0fc5b3c53ccc8fa25433df3accd4e2507..feba65aa1591ee110c1a75acf3b5f390c29be0b5 100644
--- a/chrome/browser/resources/bookmark_manager/js/bmm_test.html
+++ b/chrome/browser/resources/bookmark_manager/js/bmm_test.html
@@ -3,19 +3,22 @@
<head>
<!-- TODO(arv): Check in Closure unit tests and make this run as part of the
tests -->
-<script src="http://closure-library.googlecode.com/svn/trunk/closure/goog/base.js"></script>
-<script src="cr.js"></script>
-<script src="bmm/treeiterator.js"></script>
+<script src="https://cdn.rawgit.com/google/closure-library/master/closure/goog/base.js"></script>
+<script src="../../../../../ui/webui/resources/js/cr.js"></script>
<script src="bmm.js"></script>
+<title>Bookmark Manager Loading Test</title>
<script>
goog.require('goog.testing.jsunit');
+goog.require('goog.testing.AsyncTestCase');
</script>
</head>
<body>
<script>
+var asyncTestCase = goog.testing.AsyncTestCase.createAndInstall(document.title);
+
var tree = {
id: 0,
children: [
@@ -53,26 +56,11 @@ chrome.bookmarkManagerPrivate.getSubtree.load = function(node) {
}
};
-function setUp() {
- callbacks = {}
Dan Beam 2014/10/30 03:10:29 sharing a global context no longer worked when the
+function continueTesting() {
+ asyncTestCase.continueTesting();
}
-function testLoadSingle() {
- var calls = 0;
- function f(node) {
- calls++;
- assertEquals(tree, node);
- }
- var p = bmm.loadTree();
- p.then(f);
-
- chrome.bookmarkManagerPrivate.getSubtree.load(tree);
-
- assertEquals(1, calls);
- assertEquals(1, callbacks[''].$calls);
-}
-
-function testLoadMultiple() {
+function testLoad() {
var calls1 = 0;
var calls2 = 0;
function f1(node) {
@@ -86,29 +74,37 @@ function testLoadMultiple() {
var p = bmm.loadTree();
var p2 = bmm.loadTree();
- p.then(f1);
- p2.then(f2);
+ var r = [
+ p.then(f1),
+ p2.then(f2),
+ ];
chrome.bookmarkManagerPrivate.getSubtree.load(tree);
- assertEquals(1, calls1);
- assertEquals(1, calls2);
- assertEquals(1, callbacks[''].$calls);
-}
+ var root = Promise.all(r).then(function() {
+ assertEquals(1, calls1);
+ assertEquals(1, calls2);
+ assertEquals(1, callbacks[''].$calls);
+ });
-function testLoadSubtree() {
- var calls = 0;
- function f(node) {
- calls++;
+
+ var calls3 = 0;
+ function f3(node) {
+ calls3++;
assertEquals(tree.children[0], node);
}
- var p = bmm.loadSubtree(1);
- p.then(f);
+
+ var p3 = bmm.loadSubtree(1);
+ var s = p3.then(f3);
chrome.bookmarkManagerPrivate.getSubtree.load(tree.children[0]);
- assertEquals(1, calls);
- assertEquals(1, callbacks[1].$calls);
+ var subtree = s.then(function() {
+ assertEquals(1, calls3);
+ assertEquals(1, callbacks[1].$calls);
+ });
+
+ Promise.all([root, subtree]).then(continueTesting);
}
</script>
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/login/screen_context_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698