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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutThemeTest.cpp

Issue 1360203002: Fix media element time display for times over an hour. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: now as a unit test Created 5 years, 3 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTheme.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/LayoutThemeTest.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutThemeTest.cpp b/third_party/WebKit/Source/core/layout/LayoutThemeTest.cpp
index f6afca318f97fadcfb37dd20f3a0f809fccfa3c7..2ae728e6769e97a3ac8ba6bae0e321d011517874 100644
--- a/third_party/WebKit/Source/core/layout/LayoutThemeTest.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutThemeTest.cpp
@@ -86,4 +86,55 @@ TEST_F(LayoutThemeTest, ChangeFocusRingColor)
EXPECT_EQ(customColor, outlineColor(span));
}
+TEST_F(LayoutThemeTest, FormatMediaTime)
+{
+ struct {
+ bool newUi;
+ float time;
+ float duration;
+ String expectedResult;
+ } tests[] = {
+ {false, 1, 1, "0:01" },
+ {false, 1, 15, "0:01" },
+ {false, 1, 600, "00:01" },
+ {false, 1, 3600, "0:00:01"},
+ {false, 1, 7200, "0:00:01"},
+ {false, 15, 15, "0:15" },
+ {false, 15, 600, "00:15" },
+ {false, 15, 3600, "0:00:15"},
+ {false, 15, 7200, "0:00:15"},
+ {false, 600, 600, "10:00" },
+ {false, 600, 3600, "0:10:00"},
+ {false, 600, 7200, "0:10:00"},
+ {false, 3600, 3600, "1:00:00"},
+ {false, 3600, 7200, "1:00:00"},
+ {false, 7200, 7200, "2:00:00"},
+
+ {true, 1, 1, "0:01" },
+ {true, 1, 15, "0:01" },
+ {true, 1, 600, "0:01" },
+ {true, 1, 3600, "00:01" },
+ {true, 1, 7200, "000:01" },
+ {true, 15, 15, "0:15" },
+ {true, 15, 600, "0:15" },
+ {true, 15, 3600, "00:15" },
+ {true, 15, 7200, "000:15" },
+ {true, 600, 600, "10:00" },
+ {true, 600, 3600, "10:00" },
+ {true, 600, 7200, "010:00" },
+ {true, 3600, 3600, "60:00" },
+ {true, 3600, 7200, "060:00" },
+ {true, 7200, 7200, "120:00" },
+ };
+
+ const bool newUi = RuntimeEnabledFeatures::newMediaPlaybackUiEnabled();
+
+ for (unsigned i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) {
DaleCurtis 2015/09/25 16:49:25 for (const auto& expectation : tests) ?
+ RuntimeEnabledFeatures::setNewMediaPlaybackUiEnabled(tests[i].newUi);
+ EXPECT_EQ(tests[i].expectedResult,
+ LayoutTheme::theme().formatMediaControlsCurrentTime(tests[i].time, tests[i].duration));
+ }
+ RuntimeEnabledFeatures::setNewMediaPlaybackUiEnabled(newUi);
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTheme.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698