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