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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutThemeTest.cpp

Issue 1369763002: Fix media element time display for times over an hour. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTheme.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 (unsigned i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) {
DaleCurtis 2015/09/25 17:40:03 for (const auto& expectation : tests)
133 RuntimeEnabledFeatures::setNewMediaPlaybackUiEnabled(tests[i].newUi);
134 EXPECT_EQ(tests[i].expectedResult,
135 LayoutTheme::theme().formatMediaControlsCurrentTime(tests[i].time, t ests[i].duration));
136 }
137 RuntimeEnabledFeatures::setNewMediaPlaybackUiEnabled(newUi);
138 }
139
89 } // namespace blink 140 } // namespace blink
OLDNEW
« 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