Index: chrome/test/data/webui/load_time_data_browsertest.js |
diff --git a/chrome/test/data/webui/load_time_data_browsertest.js b/chrome/test/data/webui/load_time_data_browsertest.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..db931ccae95ddba5f59c449babd053e81a432396 |
--- /dev/null |
+++ b/chrome/test/data/webui/load_time_data_browsertest.js |
@@ -0,0 +1,56 @@ |
+// Copyright 2016 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. |
+ |
+/** |
+ * @constructor |
+ * @extends testing.Test |
+ */ |
+function LoadTimeDataTest() {} |
+ |
+LoadTimeDataTest.prototype = { |
+ __proto__: testing.Test.prototype, |
+ |
+ /** @override */ |
+ browsePreload: 'chrome://resources/html/load_time_data.html', |
+}; |
+ |
+TEST_F('LoadTimeDataTest', 'getStringPieces', function() { |
+ assertDeepEquals( |
+ [{value: 'paper', arg: null}], |
+ loadTimeData.getSubstitutedStringPieces('paper')); |
+ |
+ assertDeepEquals( |
+ [ |
+ {value: 'i think ', arg: null}, |
+ {value: 'paper mario', arg: '$1'}, |
+ {value: ' is a good game', arg: null}, |
+ ], |
+ loadTimeData.getSubstitutedStringPieces( |
+ 'i think $1 is a good game', 'paper mario')); |
+ |
+ assertDeepEquals( |
+ [ |
+ {value: 'paper mario', arg: '$1'}, |
+ {value: ' costs $', arg: null}, |
+ {value: '60', arg: '$2'}, |
+ ], |
+ loadTimeData.getSubstitutedStringPieces( |
+ '$1 costs $$$2', 'paper mario', '60')); |
+ |
+ assertDeepEquals( |
+ [ |
+ {value: '$$', arg: null}, |
+ {value: '1', arg: '$1'}, |
+ {value: '2', arg: '$2'}, |
+ {value: '1', arg: '$1'}, |
+ {value: '$', arg: null}, |
+ {value: '2', arg: '$2'}, |
+ {value: '$', arg: null}, |
+ {value: '1', arg: '$1'}, |
+ {value: '$', arg: null}, |
+ ], |
+ loadTimeData.getSubstitutedStringPieces( |
+ '$$$$$1$2$1$$$2$$$1$$', '1', '2')); |
+ |
+}); |