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/tabs/tab_audio_indicator_view_mac.h" | 5 #import "chrome/browser/ui/cocoa/tabs/tab_audio_indicator_view_mac.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 8 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
9 | 9 |
10 class TabAudioIndicatorViewMacTest : public CocoaTest { | 10 class TabAudioIndicatorViewMacTest : public CocoaTest { |
11 protected: | 11 protected: |
12 TabAudioIndicatorViewMacTest() { | 12 TabAudioIndicatorViewMacTest() { |
13 scoped_nsobject<TabAudioIndicatorViewMac> view( | 13 base::scoped_nsobject<TabAudioIndicatorViewMac> view( |
14 [[TabAudioIndicatorViewMac alloc] | 14 [[TabAudioIndicatorViewMac alloc] |
15 initWithFrame:NSMakeRect(0, 0, 16, 16)]); | 15 initWithFrame:NSMakeRect(0, 0, 16, 16)]); |
16 view_ = view.get(); | 16 view_ = view.get(); |
17 [[test_window() contentView] addSubview:view_]; | 17 [[test_window() contentView] addSubview:view_]; |
18 | 18 |
19 scoped_nsobject<NSImage> image( | 19 base::scoped_nsobject<NSImage> image( |
20 [[NSImage alloc] initWithSize:NSMakeSize(16, 16)]); | 20 [[NSImage alloc] initWithSize:NSMakeSize(16, 16)]); |
21 [image lockFocus]; | 21 [image lockFocus]; |
22 NSRectFill(NSMakeRect(0, 0, 16, 16)); | 22 NSRectFill(NSMakeRect(0, 0, 16, 16)); |
23 [image unlockFocus]; | 23 [image unlockFocus]; |
24 | 24 |
25 [view_ setBackgroundImage:image]; | 25 [view_ setBackgroundImage:image]; |
26 [view_ setIsPlayingAudio:YES]; | 26 [view_ setIsPlayingAudio:YES]; |
27 } | 27 } |
28 | 28 |
29 TabAudioIndicatorViewMac* view_; | 29 TabAudioIndicatorViewMac* view_; |
30 base::MessageLoopForUI message_loop_; // Needed for ui::LinearAnimation. | 30 base::MessageLoopForUI message_loop_; // Needed for ui::LinearAnimation. |
31 | 31 |
32 private: | 32 private: |
33 DISALLOW_COPY_AND_ASSIGN(TabAudioIndicatorViewMacTest); | 33 DISALLOW_COPY_AND_ASSIGN(TabAudioIndicatorViewMacTest); |
34 }; | 34 }; |
35 | 35 |
36 TEST_VIEW(TabAudioIndicatorViewMacTest, view_) | 36 TEST_VIEW(TabAudioIndicatorViewMacTest, view_) |
OLD | NEW |