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 |