| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/scoped_nsobject.h" | 5 #include "base/scoped_nsobject.h" |
| 6 #import "chrome/browser/cocoa/cocoa_test_helper.h" | 6 #import "chrome/browser/cocoa/cocoa_test_helper.h" |
| 7 #import "chrome/browser/cocoa/sad_tab_controller.h" | 7 #import "chrome/browser/cocoa/sad_tab_controller.h" |
| 8 #import "chrome/browser/cocoa/sad_tab_view.h" | 8 #import "chrome/browser/cocoa/sad_tab_view.h" |
| 9 #include "chrome/browser/renderer_host/test/test_render_view_host.h" | 9 #include "chrome/browser/renderer_host/test/test_render_view_host.h" |
| 10 | 10 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 NSButton* GetLinkButton(SadTabController* controller) { | 62 NSButton* GetLinkButton(SadTabController* controller) { |
| 63 SadTabView* view = static_cast<SadTabView*>([controller view]); | 63 SadTabView* view = static_cast<SadTabView*>([controller view]); |
| 64 return ([view linkButton]); | 64 return ([view linkButton]); |
| 65 } | 65 } |
| 66 | 66 |
| 67 static bool link_clicked_; | 67 static bool link_clicked_; |
| 68 CocoaTestHelperWindow* test_window_; | 68 CocoaTestHelperWindow* test_window_; |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 /* static */ |
| 72 bool SadTabControllerTest::link_clicked_; |
| 73 |
| 71 TEST_F(SadTabControllerTest, WithTabContents) { | 74 TEST_F(SadTabControllerTest, WithTabContents) { |
| 72 scoped_nsobject<SadTabController> controller(CreateController()); | 75 scoped_nsobject<SadTabController> controller(CreateController()); |
| 73 EXPECT_TRUE(controller); | 76 EXPECT_TRUE(controller); |
| 74 NSButton* link = GetLinkButton(controller); | 77 NSButton* link = GetLinkButton(controller); |
| 75 EXPECT_TRUE(link); | 78 EXPECT_TRUE(link); |
| 76 } | 79 } |
| 77 | 80 |
| 78 TEST_F(SadTabControllerTest, WithoutTabContents) { | 81 TEST_F(SadTabControllerTest, WithoutTabContents) { |
| 79 contents_.reset(); | 82 contents_.reset(); |
| 80 scoped_nsobject<SadTabController> controller(CreateController()); | 83 scoped_nsobject<SadTabController> controller(CreateController()); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 98 // Add handler for the openLearnMoreAboutCrashLink: action to NSApp for testing | 101 // Add handler for the openLearnMoreAboutCrashLink: action to NSApp for testing |
| 99 // purposes. Normally this would be sent up the responder tree correctly, but | 102 // purposes. Normally this would be sent up the responder tree correctly, but |
| 100 // since tests run in the background, key window and main window are never set | 103 // since tests run in the background, key window and main window are never set |
| 101 // on NSApplication. Adding it to NSApplication directly removes the need for | 104 // on NSApplication. Adding it to NSApplication directly removes the need for |
| 102 // worrying about what the current window with focus is. | 105 // worrying about what the current window with focus is. |
| 103 - (void)openLearnMoreAboutCrashLink:(id)sender { | 106 - (void)openLearnMoreAboutCrashLink:(id)sender { |
| 104 SadTabControllerTest::link_clicked_ = true; | 107 SadTabControllerTest::link_clicked_ = true; |
| 105 } | 108 } |
| 106 | 109 |
| 107 @end | 110 @end |
| OLD | NEW |