Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Side by Side Diff: chrome/browser/command_updater_unittest.cc

Issue 10677009: Move command handling and updating off Browser and onto a helper object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/command_updater.cc ('k') | chrome/browser/download/save_page_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/compiler_specific.h" 5 #include "base/compiler_specific.h"
6 #include "chrome/browser/command_observer.h"
6 #include "chrome/browser/command_updater.h" 7 #include "chrome/browser/command_updater.h"
7 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
8 9
9 class TestingCommandHandlerMock 10 class TestingCommandHandlerMock
10 : public CommandUpdater::CommandUpdaterDelegate { 11 : public CommandUpdater::CommandUpdaterDelegate {
11 public: 12 public:
12 virtual void ExecuteCommandWithDisposition(int id, 13 virtual void ExecuteCommandWithDisposition(int id,
13 WindowOpenDisposition) OVERRIDE { 14 WindowOpenDisposition) OVERRIDE {
14 EXPECT_EQ(1, id); 15 EXPECT_EQ(1, id);
15 } 16 }
16 }; 17 };
17 18
18 class CommandUpdaterTest : public testing::Test { 19 class CommandUpdaterTest : public testing::Test {
19 }; 20 };
20 21
21 class TestingCommandObserverMock : public CommandUpdater::CommandObserver { 22 class TestingCommandObserverMock : public CommandObserver {
22 public: 23 public:
23 TestingCommandObserverMock() : enabled_(true) {} 24 TestingCommandObserverMock() : enabled_(true) {}
24 25
25 virtual void EnabledStateChangedForCommand(int id, bool enabled) { 26 virtual void EnabledStateChangedForCommand(int id, bool enabled) {
26 enabled_ = enabled; 27 enabled_ = enabled;
27 } 28 }
28 29
29 bool enabled() const { return enabled_; } 30 bool enabled() const { return enabled_; }
30 31
31 private: 32 private:
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 101
101 // Remove one observer and update the command. Check the states, which 102 // Remove one observer and update the command. Check the states, which
102 // should be different. 103 // should be different.
103 command_updater.RemoveCommandObserver(&observer_remove); 104 command_updater.RemoveCommandObserver(&observer_remove);
104 command_updater.UpdateCommandEnabled(1, false); 105 command_updater.UpdateCommandEnabled(1, false);
105 command_updater.UpdateCommandEnabled(2, false); 106 command_updater.UpdateCommandEnabled(2, false);
106 command_updater.UpdateCommandEnabled(3, false); 107 command_updater.UpdateCommandEnabled(3, false);
107 EXPECT_TRUE(observer_remove.enabled()); 108 EXPECT_TRUE(observer_remove.enabled());
108 EXPECT_FALSE(observer_keep.enabled()); 109 EXPECT_FALSE(observer_keep.enabled());
109 } 110 }
OLDNEW
« no previous file with comments | « chrome/browser/command_updater.cc ('k') | chrome/browser/download/save_page_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698