Only grant permissions to new extensions from sync if they have the expected version
[chromium-blink-merge.git] / chrome / browser / resources / print_preview / data / measurement_system_unittest.gtestjs
blobf81960d5969e2d9ab56ec35ac508f42f850be236
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 /**
6  * Test fixture for the MeasurementSystem.
7  * @constructor
8  * @extends {testing.Test}
9  */
10 function MeasurementSystemUnitTest() {
11   testing.Test.call(this);
14 MeasurementSystemUnitTest.prototype = {
15   __proto__: testing.Test.prototype,
17   extraLibraries: [
18     '../../../../../ui/webui/resources/js/cr.js',
19     '../print_preview_utils.js',
20     'measurement_system.js'
21   ]
24 TEST_F('MeasurementSystemUnitTest', 'parseNumberFormat', function() {
25   assertTrue(areArraysEqual(
26       ['.', ','],
27       print_preview.MeasurementSystem.parseNumberFormat('123.456,78')));
28   assertTrue(areArraysEqual(
29       ['.', '.'],
30       print_preview.MeasurementSystem.parseNumberFormat('123.456.78')));
31   assertTrue(areArraysEqual(
32       [',', '.'],
33       print_preview.MeasurementSystem.parseNumberFormat('123,456.78')));
34   assertTrue(areArraysEqual(
35       [',', ','],
36       print_preview.MeasurementSystem.parseNumberFormat('123,456,78')));
37   assertTrue(areArraysEqual(
38       [' ', ','],
39       print_preview.MeasurementSystem.parseNumberFormat('123 456,78')));
40   assertTrue(areArraysEqual(
41       [' ', '.'],
42       print_preview.MeasurementSystem.parseNumberFormat('123 456.78')));
43   assertTrue(areArraysEqual(
44       [' ', ' '],
45       print_preview.MeasurementSystem.parseNumberFormat('123 456 78')));
46   assertTrue(areArraysEqual(
47       ['', ''],
48       print_preview.MeasurementSystem.parseNumberFormat('123')));
50   assertTrue(areArraysEqual(
51       [',', '.'],
52       print_preview.MeasurementSystem.parseNumberFormat('abcdef')));
53   assertTrue(areArraysEqual(
54       [',', '.'],
55       print_preview.MeasurementSystem.parseNumberFormat(null)));
56   assertTrue(areArraysEqual(
57       [',', '.'],
58       print_preview.MeasurementSystem.parseNumberFormat(undefined)));
59   assertTrue(areArraysEqual(
60       [',', '.'],
61       print_preview.MeasurementSystem.parseNumberFormat('')));
62   assertTrue(areArraysEqual(
63       [',', '.'],
64       print_preview.MeasurementSystem.parseNumberFormat('1')));
65   assertTrue(areArraysEqual(
66       [',', '.'],
67       print_preview.MeasurementSystem.parseNumberFormat('12')));
68 });