OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #import "base/scoped_nsobject.h" | 7 #import "base/scoped_nsobject.h" |
8 #include "chrome/browser/cocoa/browser_test_helper.h" | 8 #include "chrome/browser/cocoa/browser_test_helper.h" |
9 #include "chrome/browser/cocoa/cocoa_test_helper.h" | 9 #include "chrome/browser/cocoa/cocoa_test_helper.h" |
10 #import "chrome/browser/cocoa/previewable_contents_controller.h" | 10 #import "chrome/browser/cocoa/previewable_contents_controller.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 #include "testing/platform_test.h" | 12 #include "testing/platform_test.h" |
13 | 13 |
14 @interface PreviewableContentsController (ExposedForTesting) | |
15 - (NSButton*)closeButton; | |
16 @end | |
17 | |
18 @implementation PreviewableContentsController (ExposedForTesting) | |
19 - (NSButton*)closeButton { | |
20 return closeButton_; | |
21 } | |
22 @end | |
23 | |
24 namespace { | 14 namespace { |
25 | 15 |
26 class PreviewableContentsControllerTest : public CocoaTest { | 16 class PreviewableContentsControllerTest : public CocoaTest { |
27 public: | 17 public: |
28 virtual void SetUp() { | 18 virtual void SetUp() { |
29 CocoaTest::SetUp(); | 19 CocoaTest::SetUp(); |
30 controller_.reset([[PreviewableContentsController alloc] init]); | 20 controller_.reset([[PreviewableContentsController alloc] init]); |
31 [[test_window() contentView] addSubview:[controller_ view]]; | 21 [[test_window() contentView] addSubview:[controller_ view]]; |
32 } | 22 } |
33 | 23 |
34 scoped_nsobject<PreviewableContentsController> controller_; | 24 scoped_nsobject<PreviewableContentsController> controller_; |
35 }; | 25 }; |
36 | 26 |
37 TEST_VIEW(PreviewableContentsControllerTest, [controller_ view]) | 27 TEST_VIEW(PreviewableContentsControllerTest, [controller_ view]) |
38 | 28 |
39 // Adds the view to a window and displays it. | |
40 TEST_F(PreviewableContentsControllerTest, TestImagesLoadedProperly) { | |
41 EXPECT_TRUE([[[controller_ closeButton] image] isValid]); | |
42 } | |
43 | |
44 // TODO(rohitrao): Test showing and hiding the preview. This may require | 29 // TODO(rohitrao): Test showing and hiding the preview. This may require |
45 // changing the interface to take in a TabContentsView* instead of a | 30 // changing the interface to take in a TabContentsView* instead of a |
46 // TabContents*. | 31 // TabContents*. |
47 | 32 |
48 } // namespace | 33 } // namespace |
49 | 34 |
OLD | NEW |