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

Unified Diff: chrome/test/data/webui/load_time_data_browsertest.js

Issue 2917003003: [MD Bookmarks] Support elision of bookmark names in the bookmark toast. (Closed)
Patch Set: Created 3 years, 7 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/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'));
+
+});

Powered by Google App Engine
This is Rietveld 408576698