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

Side by Side Diff: ui/display/test/display_matchers.cc

Issue 2395873002: Add more options to --screen-config flag. (Closed)
Patch Set: Fix windows compile 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/test/display_matchers.h ('k') | ui/display/types/display_mode.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/display/test/display_matchers.h"
6
7 namespace display {
8
9 namespace {
10
11 const float kEpsilon = 0.0001f;
12
13 // Matcher to check DisplayMode size and refresh rate.
14 class DisplayModeMatcher
15 : public testing::MatcherInterface<const ui::DisplayMode&> {
16 public:
17 DisplayModeMatcher(int width, int height, float refresh_rate)
18 : size_(width, height), refresh_rate_(refresh_rate) {}
19
20 bool MatchAndExplain(const ui::DisplayMode& mode,
21 testing::MatchResultListener* listener) const override {
22 return mode.size() == size_ &&
23 std::fabs(mode.refresh_rate() - refresh_rate_) < kEpsilon;
24 }
25
26 void DescribeTo(std::ostream* os) const override {
27 *os << "[" << size_.ToString() << " rate=" << refresh_rate_ << "]";
28 }
29
30 void DescribeNegationTo(std::ostream* os) const override {
31 *os << "not [" << size_.ToString() << " rate=" << refresh_rate_ << "]";
32 }
33
34 private:
35 gfx::Size size_;
36 float refresh_rate_;
37 };
38
39 } // namespace
40
41 testing::Matcher<const ui::DisplayMode&> IsDisplayMode(int width,
42 int height,
43 float refresh_rate) {
44 return testing::MakeMatcher(
45 new DisplayModeMatcher(width, height, refresh_rate));
46 }
47
48 } // namespace display
OLDNEW
« no previous file with comments | « ui/display/test/display_matchers.h ('k') | ui/display/types/display_mode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698