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

Unified Diff: chrome/browser/cocoa/autocomplete_text_field_unittest.mm

Issue 600133: Mac: Content blocked icons. (Closed)
Patch Set: comments andybons Created 10 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/cocoa/autocomplete_text_field_unittest.mm
diff --git a/chrome/browser/cocoa/autocomplete_text_field_unittest.mm b/chrome/browser/cocoa/autocomplete_text_field_unittest.mm
index 4adfa6a9500e9603a45df1b729c27039f0cce0ab..b2f1f2ddc778d73d954275715064aab380cfaa43 100644
--- a/chrome/browser/cocoa/autocomplete_text_field_unittest.mm
+++ b/chrome/browser/cocoa/autocomplete_text_field_unittest.mm
@@ -27,7 +27,12 @@ class MockSecurityImageView : public LocationBarViewMac::SecurityImageView {
ToolbarModel* model)
: LocationBarViewMac::SecurityImageView(owner, profile, model) {}
- MOCK_METHOD0(OnMousePressed, bool());
+ // We can't use gmock's MOCK_METHOD macro, because it doesn't like the
+ // NSRect argument to OnMousePressed.
+ virtual void OnMousePressed(NSRect bounds) {
+ mouse_was_pressed_ = true;
+ }
+ bool mouse_was_pressed_;
};
class MockPageActionImageView : public LocationBarViewMac::PageActionImageView {
@@ -37,9 +42,8 @@ class MockPageActionImageView : public LocationBarViewMac::PageActionImageView {
// We can't use gmock's MOCK_METHOD macro, because it doesn't like the
// NSRect argument to OnMousePressed.
- virtual bool OnMousePressed(NSRect bounds) {
+ virtual void OnMousePressed(NSRect bounds) {
mouse_was_pressed_ = true;
- return true;
}
bool MouseWasPressed() { return mouse_was_pressed_; }
@@ -585,8 +589,8 @@ TEST_F(AutocompleteTextFieldObserverTest, SecurityIconMouseDown) {
NSPoint location(NSMakePoint(NSMidX(iconFrame), NSMidY(iconFrame)));
NSEvent* event(Event(field_, location, NSLeftMouseDown, 1));
- EXPECT_CALL(security_image_view, OnMousePressed());
[field_ mouseDown:event];
+ EXPECT_TRUE(security_image_view.mouse_was_pressed_);
}
// Clicking a Page Action icon should call its OnMousePressed.
@@ -657,8 +661,8 @@ TEST_F(AutocompleteTextFieldObserverTest, PageActionMouseDown) {
location = NSMakePoint(NSMidX(iconFrame), NSMidY(iconFrame));
event = Event(field_, location, NSLeftMouseDown, 1);
- EXPECT_CALL(security_image_view, OnMousePressed());
[field_ mouseDown:event];
+ EXPECT_TRUE(security_image_view.mouse_was_pressed_);
}
// Verify that -setAttributedStringValue: works as expected when

Powered by Google App Engine
This is Rietveld 408576698