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

Side by Side Diff: ash/common/system/tray/tray_details_view_unittest.cc

Issue 2780743002: Remove pre-MD code from TrayDetailsView. (Closed)
Patch Set: rebase + fix Created 3 years, 8 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/tray/tray_details_view.cc ('k') | ash/resources/ash_resources.grd » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ash/common/system/tray/tray_details_view.h" 5 #include "ash/common/system/tray/tray_details_view.h"
6 6
7 #include "ash/common/ash_view_ids.h" 7 #include "ash/common/ash_view_ids.h"
8 #include "ash/common/system/tray/hover_highlight_view.h"
9 #include "ash/common/system/tray/special_popup_row.h"
10 #include "ash/common/system/tray/system_tray.h" 8 #include "ash/common/system/tray/system_tray.h"
11 #include "ash/common/system/tray/system_tray_item.h" 9 #include "ash/common/system/tray/system_tray_item.h"
12 #include "ash/common/system/tray/tray_constants.h" 10 #include "ash/common/system/tray/tray_constants.h"
13 #include "ash/common/system/tray/tray_popup_header_button.h" 11 #include "ash/common/system/tray/tray_popup_header_button.h"
14 #include "ash/common/system/tray/view_click_listener.h" 12 #include "ash/common/system/tray/view_click_listener.h"
15 #include "ash/resources/grit/ash_resources.h" 13 #include "ash/resources/grit/ash_resources.h"
16 #include "ash/strings/grit/ash_strings.h" 14 #include "ash/strings/grit/ash_strings.h"
17 #include "ash/test/ash_test_base.h" 15 #include "ash/test/ash_test_base.h"
18 #include "base/memory/ptr_util.h" 16 #include "base/memory/ptr_util.h"
19 #include "base/run_loop.h" 17 #include "base/run_loop.h"
(...skipping 16 matching lines...) Expand all
36 // string_id. 34 // string_id.
37 CreateTitleRow(IDS_ASH_STATUS_TRAY_BLUETOOTH); 35 CreateTitleRow(IDS_ASH_STATUS_TRAY_BLUETOOTH);
38 } 36 }
39 37
40 ~TestDetailsView() override {} 38 ~TestDetailsView() override {}
41 39
42 TrayPopupHeaderButton* tray_popup_header_button() { 40 TrayPopupHeaderButton* tray_popup_header_button() {
43 return tray_popup_header_button_; 41 return tray_popup_header_button_;
44 } 42 }
45 43
46 void FocusTitleRow() { title_row()->content()->RequestFocus(); }
47
48 void CreateScrollerViews() { CreateScrollableList(); } 44 void CreateScrollerViews() { CreateScrollableList(); }
49 45
50 private: 46 private:
51 TrayPopupHeaderButton* tray_popup_header_button_; 47 TrayPopupHeaderButton* tray_popup_header_button_;
52 48
53 DISALLOW_COPY_AND_ASSIGN(TestDetailsView); 49 DISALLOW_COPY_AND_ASSIGN(TestDetailsView);
54 }; 50 };
55 51
56 // Trivial item implementation that tracks its views for testing. 52 // Trivial item implementation that tracks its views for testing.
57 class TestItem : public SystemTrayItem { 53 class TestItem : public SystemTrayItem {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 DISALLOW_COPY_AND_ASSIGN(TestItem); 88 DISALLOW_COPY_AND_ASSIGN(TestItem);
93 }; 89 };
94 90
95 } // namespace 91 } // namespace
96 92
97 class TrayDetailsViewTest : public AshTestBase { 93 class TrayDetailsViewTest : public AshTestBase {
98 public: 94 public:
99 TrayDetailsViewTest() {} 95 TrayDetailsViewTest() {}
100 ~TrayDetailsViewTest() override {} 96 ~TrayDetailsViewTest() override {}
101 97
102 HoverHighlightView* CreateAndShowHoverHighlightView() {
103 SystemTray* tray = GetPrimarySystemTray();
104 TestItem* test_item = new TestItem;
105 tray->AddTrayItem(base::WrapUnique(test_item));
106 tray->ShowDefaultView(BUBBLE_CREATE_NEW);
107 RunAllPendingInMessageLoop();
108 tray->ShowDetailedView(test_item, 0, true, BUBBLE_USE_EXISTING);
109 RunAllPendingInMessageLoop();
110
111 return static_cast<HoverHighlightView*>(
112 test_item->detailed_view()->title_row()->content());
113 }
114
115 TrayPopupHeaderButton* CreateAndShowTrayPopupHeaderButton() { 98 TrayPopupHeaderButton* CreateAndShowTrayPopupHeaderButton() {
116 SystemTray* tray = GetPrimarySystemTray(); 99 SystemTray* tray = GetPrimarySystemTray();
117 TestItem* test_item = new TestItem; 100 TestItem* test_item = new TestItem;
118 tray->AddTrayItem(base::WrapUnique(test_item)); 101 tray->AddTrayItem(base::WrapUnique(test_item));
119 tray->ShowDefaultView(BUBBLE_CREATE_NEW); 102 tray->ShowDefaultView(BUBBLE_CREATE_NEW);
120 RunAllPendingInMessageLoop(); 103 RunAllPendingInMessageLoop();
121 tray->ShowDetailedView(test_item, 0, true, BUBBLE_USE_EXISTING); 104 tray->ShowDetailedView(test_item, 0, true, BUBBLE_USE_EXISTING);
122 RunAllPendingInMessageLoop(); 105 RunAllPendingInMessageLoop();
123 106
124 return test_item->detailed_view()->tray_popup_header_button(); 107 return test_item->detailed_view()->tray_popup_header_button();
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 222
240 // Sticky header layer should be above the last child's layer. 223 // Sticky header layer should be above the last child's layer.
241 EXPECT_EQ(3u, layers.size()); 224 EXPECT_EQ(3u, layers.size());
242 EXPECT_EQ(view3->layer(), layers[0]); 225 EXPECT_EQ(view3->layer(), layers[0]);
243 EXPECT_EQ(view4->layer(), layers[1]); 226 EXPECT_EQ(view4->layer(), layers[1]);
244 EXPECT_EQ(view2->layer(), layers[2]); 227 EXPECT_EQ(view2->layer(), layers[2]);
245 } 228 }
246 229
247 } // namespace test 230 } // namespace test
248 } // namespace ash 231 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/tray/tray_details_view.cc ('k') | ash/resources/ash_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698