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

Side by Side Diff: ui/display/fake_display_snapshot_unittests.cc

Issue 2437053002: Catch bad display sizes. (Closed)
Patch Set: Created 4 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 | « ui/display/fake_display_snapshot.cc ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ui/display/fake_display_snapshot.h" 5 #include "ui/display/fake_display_snapshot.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "testing/gmock/include/gmock/gmock.h" 10 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 TEST(FakeDisplaySnapshotTest, BadDisplayMode) { 99 TEST(FakeDisplaySnapshotTest, BadDisplayMode) {
100 // Need width and height. 100 // Need width and height.
101 EXPECT_EQ(nullptr, CreateSnapshot("1024")); 101 EXPECT_EQ(nullptr, CreateSnapshot("1024"));
102 // Display height and width should be separated by 'x' not ','. 102 // Display height and width should be separated by 'x' not ','.
103 EXPECT_EQ(nullptr, CreateSnapshot("1024,768")); 103 EXPECT_EQ(nullptr, CreateSnapshot("1024,768"));
104 // Random 'a' before spec starts. 104 // Random 'a' before spec starts.
105 EXPECT_EQ(nullptr, CreateSnapshot("a1024,768")); 105 EXPECT_EQ(nullptr, CreateSnapshot("a1024,768"));
106 // Need to provide a refresh rate after '%'. 106 // Need to provide a refresh rate after '%'.
107 EXPECT_EQ(nullptr, CreateSnapshot("1024,768%")); 107 EXPECT_EQ(nullptr, CreateSnapshot("1024,768%"));
108 EXPECT_EQ(nullptr, CreateSnapshot("1024,768%a")); 108 EXPECT_EQ(nullptr, CreateSnapshot("1024,768%a"));
109 // Display resolution can't be zero for width or height.
110 EXPECT_EQ(nullptr, CreateSnapshot("000x800"));
111 EXPECT_EQ(nullptr, CreateSnapshot("800x000"));
109 // Refresh rate should come before DPI. 112 // Refresh rate should come before DPI.
110 EXPECT_EQ(nullptr, CreateSnapshot("1000x1000^300%120")); 113 EXPECT_EQ(nullptr, CreateSnapshot("1000x1000^300%120"));
111 } 114 }
112 115
113 TEST(FakeDisplaySnapshotTest, BadDPI) { 116 TEST(FakeDisplaySnapshotTest, BadDPI) {
114 // DPI should be an integer value. 117 // DPI should be an integer value.
115 EXPECT_EQ(nullptr, CreateSnapshot("1024x768^a")); 118 EXPECT_EQ(nullptr, CreateSnapshot("1024x768^a"));
116 EXPECT_EQ(nullptr, CreateSnapshot("1024x768^300d")); 119 EXPECT_EQ(nullptr, CreateSnapshot("1024x768^300d"));
117 } 120 }
118 121
(...skipping 13 matching lines...) Expand all
132 EXPECT_EQ(nullptr, display); 135 EXPECT_EQ(nullptr, display);
133 } 136 }
134 137
135 TEST(FakeDisplaySnapshotTest, BadOrderModeSeparator) { 138 TEST(FakeDisplaySnapshotTest, BadOrderModeSeparator) {
136 // Reverse the '#' and ':' delimiters for alternate display modes. 139 // Reverse the '#' and ':' delimiters for alternate display modes.
137 auto display = CreateSnapshot("1920x1080:1600x900#1280x720"); 140 auto display = CreateSnapshot("1920x1080:1600x900#1280x720");
138 EXPECT_EQ(nullptr, display); 141 EXPECT_EQ(nullptr, display);
139 } 142 }
140 143
141 } // namespace display 144 } // namespace display
OLDNEW
« no previous file with comments | « ui/display/fake_display_snapshot.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698