OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/debug/debugger.h" | 5 #include "base/debug/debugger.h" |
6 #include "base/memory/scoped_nsobject.h" | 6 #include "base/memory/scoped_nsobject.h" |
7 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 7 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
8 #import "chrome/browser/ui/cocoa/hyperlink_text_view.h" | 8 #import "chrome/browser/ui/cocoa/hyperlink_text_view.h" |
9 #import "chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h" | 9 #import "chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h" |
10 #import "chrome/browser/ui/cocoa/tab_contents/sad_tab_view.h" | 10 #import "chrome/browser/ui/cocoa/tab_contents/sad_tab_view.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 } | 45 } |
46 | 46 |
47 virtual void TearDown() { | 47 virtual void TearDown() { |
48 [test_window_ close]; | 48 [test_window_ close]; |
49 test_window_ = nil; | 49 test_window_ = nil; |
50 ChromeRenderViewHostTestHarness::TearDown(); | 50 ChromeRenderViewHostTestHarness::TearDown(); |
51 } | 51 } |
52 | 52 |
53 // Creates the controller and adds its view to contents, caller has ownership. | 53 // Creates the controller and adds its view to contents, caller has ownership. |
54 SadTabController* CreateController() { | 54 SadTabController* CreateController() { |
55 NSView* contentView = [test_window_ contentView]; | |
56 SadTabController* controller = | 55 SadTabController* controller = |
57 [[SadTabController alloc] initWithTabContents:contents() | 56 [[SadTabController alloc] initWithTabContents:contents()]; |
58 superview:contentView]; | |
59 EXPECT_TRUE(controller); | 57 EXPECT_TRUE(controller); |
60 NSView* view = [controller view]; | 58 NSView* view = [controller view]; |
61 EXPECT_TRUE(view); | 59 EXPECT_TRUE(view); |
| 60 NSView* contentView = [test_window_ contentView]; |
| 61 [contentView addSubview:view]; |
62 | 62 |
63 return controller; | 63 return controller; |
64 } | 64 } |
65 | 65 |
66 HyperlinkTextView* GetHelpTextView(SadTabController* controller) { | 66 HyperlinkTextView* GetHelpTextView(SadTabController* controller) { |
67 SadTabView* view = static_cast<SadTabView*>([controller view]); | 67 SadTabView* view = static_cast<SadTabView*>([controller view]); |
68 return ([view helpTextView]); | 68 return ([view helpTextView]); |
69 } | 69 } |
70 | 70 |
71 static bool link_clicked_; | 71 static bool link_clicked_; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 // Add handler for the openLearnMoreAboutCrashLink: action to NSApp for testing | 105 // Add handler for the openLearnMoreAboutCrashLink: action to NSApp for testing |
106 // purposes. Normally this would be sent up the responder tree correctly, but | 106 // purposes. Normally this would be sent up the responder tree correctly, but |
107 // since tests run in the background, key window and main window are never set | 107 // since tests run in the background, key window and main window are never set |
108 // on NSApplication. Adding it to NSApplication directly removes the need for | 108 // on NSApplication. Adding it to NSApplication directly removes the need for |
109 // worrying about what the current window with focus is. | 109 // worrying about what the current window with focus is. |
110 - (void)openLearnMoreAboutCrashLink:(id)sender { | 110 - (void)openLearnMoreAboutCrashLink:(id)sender { |
111 SadTabControllerTest::link_clicked_ = true; | 111 SadTabControllerTest::link_clicked_ = true; |
112 } | 112 } |
113 | 113 |
114 @end | 114 @end |
OLD | NEW |