summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/toolbar_controller.h
diff options
context:
space:
mode:
authorpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-17 19:52:40 +0000
committerpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-17 19:52:40 +0000
commit70a07ef6d9647d7b519638352cd17fa00ff22107 (patch)
tree76582ec88612d5ebd01009ef2b1bb672d123d65e /chrome/browser/cocoa/toolbar_controller.h
parent682343d9f1b8db68c75ab3c4632af2022dcc5ddf (diff)
downloadchromium_src-70a07ef6d9647d7b519638352cd17fa00ff22107.zip
chromium_src-70a07ef6d9647d7b519638352cd17fa00ff22107.tar.gz
chromium_src-70a07ef6d9647d7b519638352cd17fa00ff22107.tar.bz2
Implement a unit test for the toolbar controller. Plumb the profile into the loation bar instead of picking it up globally, which cannnot be unit tested.
Review URL: http://codereview.chromium.org/79041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13959 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/toolbar_controller.h')
-rw-r--r--chrome/browser/cocoa/toolbar_controller.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/chrome/browser/cocoa/toolbar_controller.h b/chrome/browser/cocoa/toolbar_controller.h
index 4388c15..8967aee 100644
--- a/chrome/browser/cocoa/toolbar_controller.h
+++ b/chrome/browser/cocoa/toolbar_controller.h
@@ -13,6 +13,7 @@
class CommandUpdater;
class LocationBar;
class LocationBarViewMac;
+class Profile;
class TabContents;
class ToolbarModel;
class ToolbarView;
@@ -24,9 +25,13 @@ class ToolbarView;
@private
ToolbarModel* toolbarModel_; // weak, one per window
CommandUpdater* commands_; // weak, one per window
+ Profile* profile_; // weak, one per window
scoped_ptr<CommandObserverBridge> commandObserver_;
scoped_ptr<LocationBarViewMac> locationBarView_;
+ // The ordering is important for unit tests. If new items are added or the
+ // ordering is changed, make sure to update |-toolbarViews| and the
+ // corresponding enum in the unit tests.
IBOutlet NSButton* backButton_;
IBOutlet NSButton* forwardButton_;
IBOutlet NSButton* reloadButton_;
@@ -35,9 +40,11 @@ class ToolbarView;
IBOutlet NSTextField* locationBar_;
}
-// Initialize the toolbar and register for command updates.
+// Initialize the toolbar and register for command updates. The profile is
+// needed for initializing the location bar.
- (id)initWithModel:(ToolbarModel*)model
- commands:(CommandUpdater*)commands;
+ commands:(CommandUpdater*)commands
+ profile:(Profile*)profile;
// Get the C++ bridge object representing the location bar for this tab.
- (LocationBar*)locationBar;
@@ -58,4 +65,10 @@ class ToolbarView;
@end
+// A set of private methods used by tests, in the absence of "friends" in ObjC.
+@interface ToolbarController(PrivateTestMethods)
+// Returns an array of views in the order of the outlets above.
+- (NSArray*)toolbarViews;
+@end
+
#endif // CHROME_BROWSER_COCOA_TOOLBAR_CONTROLLER_H_