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

Side by Side Diff: ash/common/system/date/system_info_default_view_unittest.cc

Issue 2734653002: chromeos: Move files in //ash/common to //ash (Closed)
Patch Set: fix a11y tests, fix docs Created 3 years, 9 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 | « ash/common/system/date/system_info_default_view.cc ('k') | ash/common/system/date/tray_date.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 "ash/common/system/date/system_info_default_view.h"
6 #include "ash/common/system/tray/tray_constants.h"
7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "ui/views/view.h"
9
10 namespace ash {
11
12 class SystemInfoDefaultViewTest : public testing::Test {
13 public:
14 SystemInfoDefaultViewTest() {}
15
16 protected:
17 // Wrapper calls for SystemInfoDefaultView internals.
18 int CalculateDateViewWidth(int preferred_width) {
19 return SystemInfoDefaultView::CalculateDateViewWidth(preferred_width);
20 }
21
22 private:
23 DISALLOW_COPY_AND_ASSIGN(SystemInfoDefaultViewTest);
24 };
25
26 TEST_F(SystemInfoDefaultViewTest, PreferredWidthSmallerThanButtonWidth) {
27 const int kPreferredWidth = 10;
28 EXPECT_LT(kPreferredWidth, kMenuButtonSize);
29 const int effective_width = CalculateDateViewWidth(kPreferredWidth);
30
31 EXPECT_EQ(effective_width,
32 kMenuButtonSize + kSeparatorWidth + kMenuButtonSize);
33 }
34
35 TEST_F(SystemInfoDefaultViewTest, PreferredWidthGreaterThanOneButtonWidth) {
36 const int kPreferredWidth = kMenuButtonSize + 1;
37 const int effective_width = CalculateDateViewWidth(kPreferredWidth);
38
39 EXPECT_EQ(effective_width,
40 kMenuButtonSize + kSeparatorWidth + kMenuButtonSize);
41 }
42
43 TEST_F(SystemInfoDefaultViewTest, PreferredWidthEqualToTwoButtonWidths) {
44 const int kPreferredWidth =
45 kMenuButtonSize + kSeparatorWidth + kMenuButtonSize;
46 const int effective_width = CalculateDateViewWidth(kPreferredWidth);
47
48 EXPECT_EQ(effective_width, kPreferredWidth);
49 }
50
51 TEST_F(SystemInfoDefaultViewTest, PreferredWidthGreaterThanTwoButtonWidths) {
52 const int kPreferredWidth =
53 kMenuButtonSize + (kSeparatorWidth + kMenuButtonSize) + 1;
54 const int effective_width = CalculateDateViewWidth(kPreferredWidth);
55
56 EXPECT_EQ(effective_width,
57 kMenuButtonSize + (kSeparatorWidth + kMenuButtonSize) * 2);
58 }
59
60 TEST_F(SystemInfoDefaultViewTest, PreferredWidthEqualToThreeButtonWidths) {
61 const int kPreferredWidth =
62 kMenuButtonSize + (kSeparatorWidth + kMenuButtonSize) * 2;
63 const int effective_width = CalculateDateViewWidth(kPreferredWidth);
64
65 EXPECT_EQ(effective_width, kPreferredWidth);
66 }
67
68 TEST_F(SystemInfoDefaultViewTest, PreferredWidthGreaterThanThreeButtonWidths) {
69 const int kPreferredWidth =
70 kMenuButtonSize + (kSeparatorWidth + kMenuButtonSize) * 2 + 1;
71 const int effective_width = CalculateDateViewWidth(kPreferredWidth);
72
73 EXPECT_EQ(effective_width,
74 kMenuButtonSize + (kSeparatorWidth + kMenuButtonSize) * 2);
75 }
76
77 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/date/system_info_default_view.cc ('k') | ash/common/system/date/tray_date.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698