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 "core/layout/LayoutTheme.h" | 5 #include "core/layout/LayoutTheme.h" |
6 | 6 |
7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
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/HTMLElement.h" | 10 #include "core/html/HTMLElement.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 Page::platformColorsChanged(); | 78 Page::platformColorsChanged(); |
79 document().view()->updateAllLifecyclePhases(); | 79 document().view()->updateAllLifecyclePhases(); |
80 | 80 |
81 // Check that the focus ring color is updated. | 81 // Check that the focus ring color is updated. |
82 EXPECT_NE(BorderStyleNone, outlineStyle(span)); | 82 EXPECT_NE(BorderStyleNone, outlineStyle(span)); |
83 EXPECT_EQ(customColor, outlineColor(span)); | 83 EXPECT_EQ(customColor, outlineColor(span)); |
84 } | 84 } |
85 | 85 |
86 TEST_F(LayoutThemeTest, FormatMediaTime) { | 86 TEST_F(LayoutThemeTest, FormatMediaTime) { |
87 struct { | 87 struct { |
88 bool newUi; | |
89 float time; | 88 float time; |
90 float duration; | 89 float duration; |
91 String expectedResult; | 90 String expectedResult; |
92 } tests[] = { | 91 } tests[] = { |
93 {false, 1, 1, "0:01"}, {false, 1, 15, "0:01"}, | 92 {1, 1, "0:01"}, {1, 15, "0:01"}, {1, 600, "0:01"}, |
94 {false, 1, 600, "00:01"}, {false, 1, 3600, "0:00:01"}, | 93 {1, 3600, "00:01"}, {1, 7200, "000:01"}, {15, 15, "0:15"}, |
95 {false, 1, 7200, "0:00:01"}, {false, 15, 15, "0:15"}, | 94 {15, 600, "0:15"}, {15, 3600, "00:15"}, {15, 7200, "000:15"}, |
96 {false, 15, 600, "00:15"}, {false, 15, 3600, "0:00:15"}, | 95 {600, 600, "10:00"}, {600, 3600, "10:00"}, {600, 7200, "010:00"}, |
97 {false, 15, 7200, "0:00:15"}, {false, 600, 600, "10:00"}, | 96 {3600, 3600, "60:00"}, {3600, 7200, "060:00"}, {7200, 7200, "120:00"}, |
98 {false, 600, 3600, "0:10:00"}, {false, 600, 7200, "0:10:00"}, | |
99 {false, 3600, 3600, "1:00:00"}, {false, 3600, 7200, "1:00:00"}, | |
100 {false, 7200, 7200, "2:00:00"}, | |
101 | |
102 {true, 1, 1, "0:01"}, {true, 1, 15, "0:01"}, | |
103 {true, 1, 600, "0:01"}, {true, 1, 3600, "00:01"}, | |
104 {true, 1, 7200, "000:01"}, {true, 15, 15, "0:15"}, | |
105 {true, 15, 600, "0:15"}, {true, 15, 3600, "00:15"}, | |
106 {true, 15, 7200, "000:15"}, {true, 600, 600, "10:00"}, | |
107 {true, 600, 3600, "10:00"}, {true, 600, 7200, "010:00"}, | |
108 {true, 3600, 3600, "60:00"}, {true, 3600, 7200, "060:00"}, | |
109 {true, 7200, 7200, "120:00"}, | |
110 }; | 97 }; |
111 | 98 |
112 const bool newUi = RuntimeEnabledFeatures::newMediaPlaybackUiEnabled(); | |
113 | |
114 for (const auto& testcase : tests) { | 99 for (const auto& testcase : tests) { |
115 RuntimeEnabledFeatures::setNewMediaPlaybackUiEnabled(testcase.newUi); | |
116 EXPECT_EQ(testcase.expectedResult, | 100 EXPECT_EQ(testcase.expectedResult, |
117 LayoutTheme::theme().formatMediaControlsCurrentTime( | 101 LayoutTheme::theme().formatMediaControlsCurrentTime( |
118 testcase.time, testcase.duration)); | 102 testcase.time, testcase.duration)); |
119 } | 103 } |
120 RuntimeEnabledFeatures::setNewMediaPlaybackUiEnabled(newUi); | |
121 } | 104 } |
122 | 105 |
123 } // namespace blink | 106 } // namespace blink |
OLD | NEW |