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

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

Issue 2890733002: Make EBorderStyle an enum class. (Closed)
Patch Set: Build for Mac Created 3 years, 7 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
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 "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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 TEST_F(LayoutThemeTest, ChangeFocusRingColor) { 52 TEST_F(LayoutThemeTest, ChangeFocusRingColor) {
53 SetHtmlInnerHTML("<span id=span tabIndex=0>Span</span>"); 53 SetHtmlInnerHTML("<span id=span tabIndex=0>Span</span>");
54 54
55 Element* span = GetDocument().getElementById(AtomicString("span")); 55 Element* span = GetDocument().getElementById(AtomicString("span"));
56 EXPECT_NE(nullptr, span); 56 EXPECT_NE(nullptr, span);
57 EXPECT_NE(nullptr, span->GetLayoutObject()); 57 EXPECT_NE(nullptr, span->GetLayoutObject());
58 58
59 Color custom_color = MakeRGB(123, 145, 167); 59 Color custom_color = MakeRGB(123, 145, 167);
60 60
61 // Checking unfocused style. 61 // Checking unfocused style.
62 EXPECT_EQ(kBorderStyleNone, OutlineStyle(span)); 62 EXPECT_EQ(EBorderStyle::kNone, OutlineStyle(span));
63 EXPECT_NE(custom_color, OutlineColor(span)); 63 EXPECT_NE(custom_color, OutlineColor(span));
64 64
65 // Do focus. 65 // Do focus.
66 GetDocument().GetPage()->GetFocusController().SetActive(true); 66 GetDocument().GetPage()->GetFocusController().SetActive(true);
67 GetDocument().GetPage()->GetFocusController().SetFocused(true); 67 GetDocument().GetPage()->GetFocusController().SetFocused(true);
68 span->focus(); 68 span->focus();
69 GetDocument().View()->UpdateAllLifecyclePhases(); 69 GetDocument().View()->UpdateAllLifecyclePhases();
70 70
71 // Checking focused style. 71 // Checking focused style.
72 EXPECT_NE(kBorderStyleNone, OutlineStyle(span)); 72 EXPECT_NE(EBorderStyle::kNone, OutlineStyle(span));
73 EXPECT_NE(custom_color, OutlineColor(span)); 73 EXPECT_NE(custom_color, OutlineColor(span));
74 74
75 // Change focus ring color. 75 // Change focus ring color.
76 LayoutTheme::GetTheme().SetCustomFocusRingColor(custom_color); 76 LayoutTheme::GetTheme().SetCustomFocusRingColor(custom_color);
77 Page::PlatformColorsChanged(); 77 Page::PlatformColorsChanged();
78 GetDocument().View()->UpdateAllLifecyclePhases(); 78 GetDocument().View()->UpdateAllLifecyclePhases();
79 79
80 // Check that the focus ring color is updated. 80 // Check that the focus ring color is updated.
81 EXPECT_NE(kBorderStyleNone, OutlineStyle(span)); 81 EXPECT_NE(EBorderStyle::kNone, OutlineStyle(span));
82 EXPECT_EQ(custom_color, OutlineColor(span)); 82 EXPECT_EQ(custom_color, OutlineColor(span));
83 } 83 }
84 84
85 TEST_F(LayoutThemeTest, FormatMediaTime) { 85 TEST_F(LayoutThemeTest, FormatMediaTime) {
86 struct { 86 struct {
87 float time; 87 float time;
88 float duration; 88 float duration;
89 String expected_result; 89 String expected_result;
90 } tests[] = { 90 } tests[] = {
91 {1, 1, "0:01"}, {1, 15, "0:01"}, {1, 600, "0:01"}, 91 {1, 1, "0:01"}, {1, 15, "0:01"}, {1, 600, "0:01"},
92 {1, 3600, "00:01"}, {1, 7200, "000:01"}, {15, 15, "0:15"}, 92 {1, 3600, "00:01"}, {1, 7200, "000:01"}, {15, 15, "0:15"},
93 {15, 600, "0:15"}, {15, 3600, "00:15"}, {15, 7200, "000:15"}, 93 {15, 600, "0:15"}, {15, 3600, "00:15"}, {15, 7200, "000:15"},
94 {600, 600, "10:00"}, {600, 3600, "10:00"}, {600, 7200, "010:00"}, 94 {600, 600, "10:00"}, {600, 3600, "10:00"}, {600, 7200, "010:00"},
95 {3600, 3600, "60:00"}, {3600, 7200, "060:00"}, {7200, 7200, "120:00"}, 95 {3600, 3600, "60:00"}, {3600, 7200, "060:00"}, {7200, 7200, "120:00"},
96 }; 96 };
97 97
98 for (const auto& testcase : tests) { 98 for (const auto& testcase : tests) {
99 EXPECT_EQ(testcase.expected_result, 99 EXPECT_EQ(testcase.expected_result,
100 LayoutTheme::GetTheme().FormatMediaControlsCurrentTime( 100 LayoutTheme::GetTheme().FormatMediaControlsCurrentTime(
101 testcase.time, testcase.duration)); 101 testcase.time, testcase.duration));
102 } 102 }
103 } 103 }
104 104
105 } // namespace blink 105 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutThemeMac.mm ('k') | third_party/WebKit/Source/core/layout/LayoutTreeAsText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698