OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "core/layout/LayoutTheme.h" | 6 #include "core/layout/LayoutTheme.h" |
7 | 7 |
8 #include "core/dom/NodeComputedStyle.h" | 8 #include "core/dom/NodeComputedStyle.h" |
9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
10 #include "core/html/HTMLDocument.h" | 10 #include "core/html/HTMLDocument.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 // Change focus ring color. | 79 // Change focus ring color. |
80 LayoutTheme::theme().setCustomFocusRingColor(customColor); | 80 LayoutTheme::theme().setCustomFocusRingColor(customColor); |
81 Page::platformColorsChanged(); | 81 Page::platformColorsChanged(); |
82 document().view()->updateAllLifecyclePhases(); | 82 document().view()->updateAllLifecyclePhases(); |
83 | 83 |
84 // Check that the focus ring color is updated. | 84 // Check that the focus ring color is updated. |
85 EXPECT_NE(BNONE, outlineStyle(span)); | 85 EXPECT_NE(BNONE, outlineStyle(span)); |
86 EXPECT_EQ(customColor, outlineColor(span)); | 86 EXPECT_EQ(customColor, outlineColor(span)); |
87 } | 87 } |
88 | 88 |
| 89 TEST_F(LayoutThemeTest, FormatMediaTime) |
| 90 { |
| 91 struct { |
| 92 bool newUi; |
| 93 float time; |
| 94 float duration; |
| 95 String expectedResult; |
| 96 } tests[] = { |
| 97 {false, 1, 1, "0:01" }, |
| 98 {false, 1, 15, "0:01" }, |
| 99 {false, 1, 600, "00:01" }, |
| 100 {false, 1, 3600, "0:00:01"}, |
| 101 {false, 1, 7200, "0:00:01"}, |
| 102 {false, 15, 15, "0:15" }, |
| 103 {false, 15, 600, "00:15" }, |
| 104 {false, 15, 3600, "0:00:15"}, |
| 105 {false, 15, 7200, "0:00:15"}, |
| 106 {false, 600, 600, "10:00" }, |
| 107 {false, 600, 3600, "0:10:00"}, |
| 108 {false, 600, 7200, "0:10:00"}, |
| 109 {false, 3600, 3600, "1:00:00"}, |
| 110 {false, 3600, 7200, "1:00:00"}, |
| 111 {false, 7200, 7200, "2:00:00"}, |
| 112 |
| 113 {true, 1, 1, "0:01" }, |
| 114 {true, 1, 15, "0:01" }, |
| 115 {true, 1, 600, "0:01" }, |
| 116 {true, 1, 3600, "00:01" }, |
| 117 {true, 1, 7200, "000:01" }, |
| 118 {true, 15, 15, "0:15" }, |
| 119 {true, 15, 600, "0:15" }, |
| 120 {true, 15, 3600, "00:15" }, |
| 121 {true, 15, 7200, "000:15" }, |
| 122 {true, 600, 600, "10:00" }, |
| 123 {true, 600, 3600, "10:00" }, |
| 124 {true, 600, 7200, "010:00" }, |
| 125 {true, 3600, 3600, "60:00" }, |
| 126 {true, 3600, 7200, "060:00" }, |
| 127 {true, 7200, 7200, "120:00" }, |
| 128 }; |
| 129 |
| 130 const bool newUi = RuntimeEnabledFeatures::newMediaPlaybackUiEnabled(); |
| 131 |
| 132 for (const auto& testcase : tests) { |
| 133 RuntimeEnabledFeatures::setNewMediaPlaybackUiEnabled(testcase.newUi); |
| 134 EXPECT_EQ(testcase.expectedResult, |
| 135 LayoutTheme::theme().formatMediaControlsCurrentTime(testcase.time, t
estcase.duration)); |
| 136 } |
| 137 RuntimeEnabledFeatures::setNewMediaPlaybackUiEnabled(newUi); |
| 138 } |
| 139 |
89 } // namespace blink | 140 } // namespace blink |
OLD | NEW |