OLD | NEW |
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/system/chromeos/screen_security/screen_tray_item.h" | 5 #include "ash/system/chromeos/screen_security/screen_tray_item.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/system/chromeos/screen_security/screen_capture_tray_item.h" | 8 #include "ash/system/chromeos/screen_security/screen_capture_tray_item.h" |
9 #include "ash/system/chromeos/screen_security/screen_share_tray_item.h" | 9 #include "ash/system/chromeos/screen_security/screen_share_tray_item.h" |
10 #include "ash/system/tray/tray_item_view.h" | 10 #include "ash/system/tray/tray_item_view.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 public: | 46 public: |
47 ScreenTrayItemTest() | 47 ScreenTrayItemTest() |
48 : tray_item_(NULL), stop_callback_hit_count_(0) {} | 48 : tray_item_(NULL), stop_callback_hit_count_(0) {} |
49 virtual ~ScreenTrayItemTest() {} | 49 virtual ~ScreenTrayItemTest() {} |
50 | 50 |
51 ScreenTrayItem* tray_item() { return tray_item_; } | 51 ScreenTrayItem* tray_item() { return tray_item_; } |
52 void set_tray_item(ScreenTrayItem* tray_item) { tray_item_ = tray_item; } | 52 void set_tray_item(ScreenTrayItem* tray_item) { tray_item_ = tray_item; } |
53 | 53 |
54 int stop_callback_hit_count() const { return stop_callback_hit_count_; } | 54 int stop_callback_hit_count() const { return stop_callback_hit_count_; } |
55 | 55 |
56 virtual void SetUp() OVERRIDE { | 56 virtual void SetUp() override { |
57 test::AshTestBase::SetUp(); | 57 test::AshTestBase::SetUp(); |
58 TrayItemView::DisableAnimationsForTest(); | 58 TrayItemView::DisableAnimationsForTest(); |
59 } | 59 } |
60 | 60 |
61 void StartSession() { | 61 void StartSession() { |
62 tray_item_->Start( | 62 tray_item_->Start( |
63 base::Bind(&ScreenTrayItemTest::StopCallback, base::Unretained(this))); | 63 base::Bind(&ScreenTrayItemTest::StopCallback, base::Unretained(this))); |
64 } | 64 } |
65 | 65 |
66 void StopSession() { | 66 void StopSession() { |
67 tray_item_->Stop(); | 67 tray_item_->Stop(); |
68 } | 68 } |
69 | 69 |
70 void StopCallback() { | 70 void StopCallback() { |
71 stop_callback_hit_count_++; | 71 stop_callback_hit_count_++; |
72 } | 72 } |
73 | 73 |
74 private: | 74 private: |
75 ScreenTrayItem* tray_item_; | 75 ScreenTrayItem* tray_item_; |
76 int stop_callback_hit_count_; | 76 int stop_callback_hit_count_; |
77 | 77 |
78 DISALLOW_COPY_AND_ASSIGN(ScreenTrayItemTest); | 78 DISALLOW_COPY_AND_ASSIGN(ScreenTrayItemTest); |
79 }; | 79 }; |
80 | 80 |
81 class ScreenCaptureTest : public ScreenTrayItemTest { | 81 class ScreenCaptureTest : public ScreenTrayItemTest { |
82 public: | 82 public: |
83 ScreenCaptureTest() {} | 83 ScreenCaptureTest() {} |
84 virtual ~ScreenCaptureTest() {} | 84 virtual ~ScreenCaptureTest() {} |
85 | 85 |
86 virtual void SetUp() OVERRIDE { | 86 virtual void SetUp() override { |
87 ScreenTrayItemTest::SetUp(); | 87 ScreenTrayItemTest::SetUp(); |
88 // This tray item is owned by its parent system tray view and will | 88 // This tray item is owned by its parent system tray view and will |
89 // be deleted automatically when its parent is destroyed in AshTestBase. | 89 // be deleted automatically when its parent is destroyed in AshTestBase. |
90 ScreenTrayItem* tray_item = new ScreenCaptureTrayItem(GetSystemTray()); | 90 ScreenTrayItem* tray_item = new ScreenCaptureTrayItem(GetSystemTray()); |
91 GetSystemTray()->AddTrayItem(tray_item); | 91 GetSystemTray()->AddTrayItem(tray_item); |
92 set_tray_item(tray_item); | 92 set_tray_item(tray_item); |
93 } | 93 } |
94 | 94 |
95 DISALLOW_COPY_AND_ASSIGN(ScreenCaptureTest); | 95 DISALLOW_COPY_AND_ASSIGN(ScreenCaptureTest); |
96 }; | 96 }; |
97 | 97 |
98 class ScreenShareTest : public ScreenTrayItemTest { | 98 class ScreenShareTest : public ScreenTrayItemTest { |
99 public: | 99 public: |
100 ScreenShareTest() {} | 100 ScreenShareTest() {} |
101 virtual ~ScreenShareTest() {} | 101 virtual ~ScreenShareTest() {} |
102 | 102 |
103 virtual void SetUp() OVERRIDE { | 103 virtual void SetUp() override { |
104 ScreenTrayItemTest::SetUp(); | 104 ScreenTrayItemTest::SetUp(); |
105 // This tray item is owned by its parent system tray view and will | 105 // This tray item is owned by its parent system tray view and will |
106 // be deleted automatically when its parent is destroyed in AshTestBase. | 106 // be deleted automatically when its parent is destroyed in AshTestBase. |
107 ScreenTrayItem* tray_item = new ScreenShareTrayItem(GetSystemTray()); | 107 ScreenTrayItem* tray_item = new ScreenShareTrayItem(GetSystemTray()); |
108 GetSystemTray()->AddTrayItem(tray_item); | 108 GetSystemTray()->AddTrayItem(tray_item); |
109 set_tray_item(tray_item); | 109 set_tray_item(tray_item); |
110 } | 110 } |
111 | 111 |
112 DISALLOW_COPY_AND_ASSIGN(ScreenShareTest); | 112 DISALLOW_COPY_AND_ASSIGN(ScreenShareTest); |
113 }; | 113 }; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 217 |
218 TEST_F(ScreenCaptureTest, SystemTrayInteraction) { | 218 TEST_F(ScreenCaptureTest, SystemTrayInteraction) { |
219 TestSystemTrayInteraction(this); | 219 TestSystemTrayInteraction(this); |
220 } | 220 } |
221 | 221 |
222 TEST_F(ScreenShareTest, SystemTrayInteraction) { | 222 TEST_F(ScreenShareTest, SystemTrayInteraction) { |
223 TestSystemTrayInteraction(this); | 223 TestSystemTrayInteraction(this); |
224 } | 224 } |
225 | 225 |
226 } // namespace ash | 226 } // namespace ash |
OLD | NEW |