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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #import "base/scoped_nsobject.h" | 7 #import "base/scoped_nsobject.h" |
8 #import "chrome/app/keystone_glue.h" | 8 #import "chrome/app/keystone_glue.h" |
9 #import "chrome/browser/cocoa/about_window_controller.h" | 9 #import "chrome/browser/cocoa/about_window_controller.h" |
10 #include "chrome/browser/cocoa/browser_test_helper.h" | 10 #include "chrome/browser/cocoa/browser_test_helper.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 ASSERT_TRUE(button); | 77 ASSERT_TRUE(button); |
78 | 78 |
79 // Not enabled until we know if updates are available. | 79 // Not enabled until we know if updates are available. |
80 ASSERT_FALSE([button isEnabled]); | 80 ASSERT_FALSE([button isEnabled]); |
81 PostAutoupdateStatusNotification(kAutoupdateAvailable, nil); | 81 PostAutoupdateStatusNotification(kAutoupdateAvailable, nil); |
82 ASSERT_TRUE([button isEnabled]); | 82 ASSERT_TRUE([button isEnabled]); |
83 | 83 |
84 // Make sure the button is hooked up | 84 // Make sure the button is hooked up |
85 ASSERT_EQ([button target], about_window_controller_.get()); | 85 ASSERT_EQ([button target], about_window_controller_.get()); |
86 ASSERT_EQ([button action], @selector(updateNow:)); | 86 ASSERT_EQ([button action], @selector(updateNow:)); |
87 | |
88 // Make sure the button is disabled once clicked | |
89 [about_window_controller_ updateNow:about_window_controller_.get()]; | |
90 ASSERT_FALSE([button isEnabled]); | |
91 } | 87 } |
92 | 88 |
93 // Doesn't confirm correctness, but does confirm something happens. | 89 // Doesn't confirm correctness, but does confirm something happens. |
94 TEST_F(AboutWindowControllerTest, TestCallbacks) { | 90 TEST_F(AboutWindowControllerTest, TestCallbacks) { |
95 NSString *lastText = [[about_window_controller_ updateText] | 91 NSString *lastText = [[about_window_controller_ updateText] |
96 stringValue]; | 92 stringValue]; |
97 PostAutoupdateStatusNotification(kAutoupdateCurrent, @"foo"); | 93 PostAutoupdateStatusNotification(kAutoupdateCurrent, @"foo"); |
98 ASSERT_FALSE([lastText isEqual:[[about_window_controller_ updateText] | 94 ASSERT_FALSE([lastText isEqual:[[about_window_controller_ updateText] |
99 stringValue]]); | 95 stringValue]]); |
100 | 96 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 stringValue]]); | 131 stringValue]]); |
136 #endif | 132 #endif |
137 | 133 |
138 lastText = [[about_window_controller_ updateText] stringValue]; | 134 lastText = [[about_window_controller_ updateText] stringValue]; |
139 PostAutoupdateStatusNotification(kAutoupdateInstallFailed, nil); | 135 PostAutoupdateStatusNotification(kAutoupdateInstallFailed, nil); |
140 ASSERT_FALSE([lastText isEqual:[[about_window_controller_ | 136 ASSERT_FALSE([lastText isEqual:[[about_window_controller_ |
141 updateText] stringValue]]); | 137 updateText] stringValue]]); |
142 } | 138 } |
143 | 139 |
144 } // namespace | 140 } // namespace |
OLD | NEW |