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

Unified Diff: chrome/browser/resources/shared/js/cr/ui/array_data_model_test.html

Issue 11962043: Move webui resources from chrome\browser\resources\shared to ui\webui\resources. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: 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/browser/resources/shared/js/cr/ui/array_data_model_test.html
===================================================================
--- chrome/browser/resources/shared/js/cr/ui/array_data_model_test.html (revision 177292)
+++ chrome/browser/resources/shared/js/cr/ui/array_data_model_test.html (working copy)
@@ -1,92 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<script src="http://closure-library.googlecode.com/svn/trunk/closure/goog/base.js"></script>
-<script src="../../cr.js"></script>
-<script src="../event_target.js"></script>
-<script src="array_data_model.js"></script>
-<script>
-
-goog.require('goog.testing.jsunit');
-
-</script>
-
-</head>
-<body>
-
-<script>
-
-function testSlice() {
- var m = new cr.ui.ArrayDataModel([0, 1, 2]);
- assertArrayEquals([0, 1, 2], m.slice());
- assertArrayEquals([1, 2], m.slice(1));
- assertArrayEquals([1], m.slice(1, 2));
-}
-
-function testPush() {
- var m = new cr.ui.ArrayDataModel([0, 1, 2]);
-
- var count = 0;
- m.addEventListener('splice', function(e) {
- count++;
- assertEquals(3, e.index);
- assertArrayEquals([], e.removed);
- assertArrayEquals([3, 4], e.added);
- });
-
- assertEquals(5, m.push(3, 4));
- var a = m.slice();
- assertArrayEquals([0, 1, 2, 3, 4], a);
-
- assertEquals('The splice event should only fire once', 1, count);
-}
-
-function testSplice() {
- function compare(array, args) {
- var m = new cr.ui.ArrayDataModel(array.slice());
- var expected = array.slice();
- var result = expected.splice.apply(expected, args);
- assertArrayEquals(result, m.splice.apply(m, args));
- assertArrayEquals(expected, m.slice());
- }
-
- compare([1, 2, 3], []);
- compare([1, 2, 3], [0, 0]);
- compare([1, 2, 3], [0, 1]);
- compare([1, 2, 3], [1, 1]);
- compare([1, 2, 3], [0, 3]);
- compare([1, 2, 3], [0, 1, 5]);
- compare([1, 2, 3], [0, 3, 1, 2, 3]);
- compare([1, 2, 3], [5, 3, 1, 2, 3]);
-}
-
-function testPermutation() {
- function doTest(sourceArray, spliceArgs) {
- var m = new cr.ui.ArrayDataModel(sourceArray.slice());
- var permutation;
- m.addEventListener('permuted', function(event) {
- permutation = event.permutation;
- });
- m.splice.apply(m, spliceArgs);
- var deleted = 0;
- for (var i = 0; i < sourceArray.length; i++) {
- if (permutation[i] == -1)
- deleted++;
- else
- assertEquals(sourceArray[i], m.item(permutation[i]));
- }
- assertEquals(deleted, spliceArgs[1]);
- }
-
- doTest([1, 2, 3], [0, 0]);
- doTest([1, 2, 3], [0, 1]);
- doTest([1, 2, 3], [1, 1]);
- doTest([1, 2, 3], [0, 3]);
- doTest([1, 2, 3], [0, 1, 5]);
- doTest([1, 2, 3], [0, 3, 1, 2, 3]);
-}
-
-</script>
-
-</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698