OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #import "chrome/browser/ui/cocoa/toolbar/app_toolbar_button_cell.h" | 5 #import "chrome/browser/ui/cocoa/toolbar/app_toolbar_button_cell.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/test/scoped_task_environment.h" |
9 #import "chrome/browser/ui/cocoa/test/cocoa_test_helper.h" | 9 #import "chrome/browser/ui/cocoa/test/cocoa_test_helper.h" |
10 | 10 |
11 @interface TestAppToolbarButton : NSButton | 11 @interface TestAppToolbarButton : NSButton |
12 @end | 12 @end |
13 | 13 |
14 @implementation TestAppToolbarButton | 14 @implementation TestAppToolbarButton |
15 | 15 |
16 + (Class)cellClass { | 16 + (Class)cellClass { |
17 return [AppToolbarButtonCell class]; | 17 return [AppToolbarButtonCell class]; |
18 } | 18 } |
19 | 19 |
20 @end | 20 @end |
21 | 21 |
22 class AppToolbarButtonCellTest : public CocoaTest { | 22 class AppToolbarButtonCellTest : public CocoaTest { |
23 protected: | 23 protected: |
24 AppToolbarButtonCellTest() { | 24 AppToolbarButtonCellTest() |
25 : scoped_task_environment_( | |
26 base::test::ScopedTaskEnvironment::MainThreadType::UI) { | |
25 base::scoped_nsobject<NSButton> button([[TestAppToolbarButton alloc] | 27 base::scoped_nsobject<NSButton> button([[TestAppToolbarButton alloc] |
26 initWithFrame:NSMakeRect(0, 0, 29, 29)]); | 28 initWithFrame:NSMakeRect(0, 0, 29, 29)]); |
27 button_ = button; | 29 button_ = button; |
28 [[test_window() contentView] addSubview:button_]; | 30 [[test_window() contentView] addSubview:button_]; |
29 } | 31 } |
30 | 32 |
31 NSButton* button_; | 33 NSButton* button_; |
32 base::scoped_nsobject<AppToolbarButtonCell> cell_; | 34 base::scoped_nsobject<AppToolbarButtonCell> cell_; |
33 base::MessageLoopForUI message_loop_; // Needed for gfx::Animation. | 35 base::test::ScopedTaskEnvironment |
36 scoped_task_environment_; // Needed for gfx::Animation. | |
sky
2017/04/27 22:17:46
Move the comment above the member.
fdoray
2017/05/01 17:44:59
Done.
| |
34 | 37 |
35 private: | 38 private: |
36 DISALLOW_COPY_AND_ASSIGN(AppToolbarButtonCellTest); | 39 DISALLOW_COPY_AND_ASSIGN(AppToolbarButtonCellTest); |
37 }; | 40 }; |
38 | 41 |
39 TEST_VIEW(AppToolbarButtonCellTest, button_) | 42 TEST_VIEW(AppToolbarButtonCellTest, button_) |
OLD | NEW |