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

Unified Diff: ui/android/junit/src/org/chromium/ui/base/SelectFileDialogTest.java

Issue 2737843004: Fix UMA metric to not count multiple image/ tags as generic. (Closed)
Patch Set: Remove one redundant test Created 3 years, 9 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: ui/android/junit/src/org/chromium/ui/base/SelectFileDialogTest.java
diff --git a/ui/android/junit/src/org/chromium/ui/base/SelectFileDialogTest.java b/ui/android/junit/src/org/chromium/ui/base/SelectFileDialogTest.java
index aaae9c83351e4f486498a9e400aef9b3ad28b84f..91b45e2aaec1908abcc3fbfe86d528e75ed7a9dd 100644
--- a/ui/android/junit/src/org/chromium/ui/base/SelectFileDialogTest.java
+++ b/ui/android/junit/src/org/chromium/ui/base/SelectFileDialogTest.java
@@ -56,6 +56,30 @@ public class SelectFileDialogTest {
assertEquals(SelectFileDialog.SELECT_FILE_DIALOG_SCOPE_GENERIC,
scopeForFileTypes("image/x-png", "image/gif", "image/jpeg", "text/plain"));
+ // Test image extensions only.
+ assertEquals(SelectFileDialog.SELECT_FILE_DIALOG_SCOPE_IMAGES,
+ scopeForFileTypes(".jpg", ".jpeg", ".png", ".gif", ".apng", ".tiff", ".tif", ".bmp",
+ ".pdf", ".xcf", ".webp"));
+ // Test image extensions mixed with image MIME types.
+ assertEquals(SelectFileDialog.SELECT_FILE_DIALOG_SCOPE_IMAGES,
+ scopeForFileTypes(".JPG", ".jpeg", "image/gif", "image/jpeg"));
+ // Image extensions mixed with image MIME types and other.
+ assertEquals(SelectFileDialog.SELECT_FILE_DIALOG_SCOPE_GENERIC,
+ scopeForFileTypes(".jpg", "image/gif", "text/plain"));
+ // Video extensions only.
+ assertEquals(SelectFileDialog.SELECT_FILE_DIALOG_SCOPE_VIDEOS,
+ scopeForFileTypes(".asf", ".avhcd", ".avi", ".flv", ".mov", ".mp4", ".mpeg", ".mpg",
+ ".swf", ".wmv", ".webm", ".mkv", ".divx"));
+ // Video extensions and video MIME types.
+ assertEquals(SelectFileDialog.SELECT_FILE_DIALOG_SCOPE_VIDEOS,
+ scopeForFileTypes(".avi", ".mp4", "video/ogg"));
+ // Video extensions and video MIME types and other.
+ assertEquals(SelectFileDialog.SELECT_FILE_DIALOG_SCOPE_GENERIC,
+ scopeForFileTypes(".avi", ".mp4", "video/ogg", "text/plain"));
+
+ // Non-image, non-video extension only.
+ assertEquals(SelectFileDialog.SELECT_FILE_DIALOG_SCOPE_GENERIC, scopeForFileTypes(".doc"));
+
assertEquals(SelectFileDialog.SELECT_FILE_DIALOG_SCOPE_IMAGES_AND_VIDEOS,
scopeForFileTypes("video/*", "image/*"));
assertEquals(SelectFileDialog.SELECT_FILE_DIALOG_SCOPE_IMAGES_AND_VIDEOS,

Powered by Google App Engine
This is Rietveld 408576698