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

Unified Diff: LayoutTests/vibration/vibration-utils.js

Issue 40443002: Add Vibration API layout tests that inspect internal state. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase. Address review comments. Created 7 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
Index: LayoutTests/vibration/vibration-utils.js
diff --git a/LayoutTests/vibration/vibration-utils.js b/LayoutTests/vibration/vibration-utils.js
new file mode 100644
index 0000000000000000000000000000000000000000..1fb0058c70d6b7eac628b23a35cb037e48295a0d
--- /dev/null
+++ b/LayoutTests/vibration/vibration-utils.js
@@ -0,0 +1,18 @@
+/**
+ * Creates a new array with length equal to [entries]. Each entry has the
+ * value [milliseconds].
+ */
+function newPattern(milliseconds, entries) {
+ var pattern = new Array(entries);
+ for (var i = 0; i < entries; i++) {
+ pattern[i] = milliseconds;
+ }
+ return pattern;
+}
+
+/**
+ * Stop any currently running vibration. Call this to clean up internal state.
+ */
+function stopVibration() {
+ navigator.vibrate(0);
+}
« no previous file with comments | « LayoutTests/vibration/vibration-patterns-expected.txt ('k') | Source/modules/vibration/NavigatorVibration.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698