| 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include "base/memory/scoped_nsobject.h" | 7 #include "base/memory/scoped_nsobject.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "chrome/browser/command_updater.h" |
| 9 #import "chrome/browser/ui/cocoa/command_observer_bridge.h" | 10 #import "chrome/browser/ui/cocoa/command_observer_bridge.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 11 #include "testing/platform_test.h" | 12 #include "testing/platform_test.h" |
| 12 | 13 |
| 13 // Implements the callback interface. Records the last command id and | 14 // Implements the callback interface. Records the last command id and |
| 14 // enabled state it has received so it can be queried by the tests to see | 15 // enabled state it has received so it can be queried by the tests to see |
| 15 // if we got a notification or not. | 16 // if we got a notification or not. |
| 16 @interface CommandTestObserver : NSObject<CommandObserverProtocol> { | 17 @interface CommandTestObserver : NSObject<CommandObserverProtocol> { |
| 17 @private | 18 @private |
| 18 int lastCommand_; // id of last received state change | 19 int lastCommand_; // id of last received state change |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 81 |
| 81 // Change something we're not watching and make sure the last state hasn't | 82 // Change something we're not watching and make sure the last state hasn't |
| 82 // changed. | 83 // changed. |
| 83 updater_->UpdateCommandEnabled(3, false); | 84 updater_->UpdateCommandEnabled(3, false); |
| 84 EXPECT_EQ([observer_ lastCommand], 1); | 85 EXPECT_EQ([observer_ lastCommand], 1); |
| 85 EXPECT_NE([observer_ lastCommand], 3); | 86 EXPECT_NE([observer_ lastCommand], 3); |
| 86 EXPECT_EQ([observer_ lastState], true); | 87 EXPECT_EQ([observer_ lastState], true); |
| 87 } | 88 } |
| 88 | 89 |
| 89 } // namespace | 90 } // namespace |
| OLD | NEW |