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

Side by Side Diff: chrome/browser/ui/cocoa/toolbar/toolbar_controller_unittest.mm

Issue 151283006: Mac OS X: Show the Translate icon on Omnibox (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue-307352-translate-bubble-2
Patch Set: Use kAnimateNone Created 6 years, 9 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
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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #import "base/mac/scoped_nsobject.h" 7 #import "base/mac/scoped_nsobject.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/command_updater.h" 10 #include "chrome/browser/command_updater.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 209
210 TEST_F(ToolbarControllerTest, BookmarkBubblePoint) { 210 TEST_F(ToolbarControllerTest, BookmarkBubblePoint) {
211 const NSPoint starPoint = [bar_ bookmarkBubblePoint]; 211 const NSPoint starPoint = [bar_ bookmarkBubblePoint];
212 const NSRect barFrame = 212 const NSRect barFrame =
213 [[bar_ view] convertRect:[[bar_ view] bounds] toView:nil]; 213 [[bar_ view] convertRect:[[bar_ view] bounds] toView:nil];
214 214
215 // Make sure the star is completely inside the location bar. 215 // Make sure the star is completely inside the location bar.
216 EXPECT_TRUE(NSPointInRect(starPoint, barFrame)); 216 EXPECT_TRUE(NSPointInRect(starPoint, barFrame));
217 } 217 }
218 218
219 TEST_F(ToolbarControllerTest, TranslateBubblePoint) {
220 const NSPoint translatePoint = [bar_ translateBubblePoint];
221 const NSRect barFrame =
222 [[bar_ view] convertRect:[[bar_ view] bounds] toView:nil];
223 EXPECT_TRUE(NSPointInRect(translatePoint, barFrame));
224 }
225
219 TEST_F(ToolbarControllerTest, HoverButtonForEvent) { 226 TEST_F(ToolbarControllerTest, HoverButtonForEvent) {
220 base::scoped_nsobject<HitView> view( 227 base::scoped_nsobject<HitView> view(
221 [[HitView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)]); 228 [[HitView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)]);
222 [bar_ setView:view]; 229 [bar_ setView:view];
223 NSEvent* event = [NSEvent mouseEventWithType:NSMouseMoved 230 NSEvent* event = [NSEvent mouseEventWithType:NSMouseMoved
224 location:NSMakePoint(10,10) 231 location:NSMakePoint(10,10)
225 modifierFlags:0 232 modifierFlags:0
226 timestamp:0 233 timestamp:0
227 windowNumber:0 234 windowNumber:0
228 context:nil 235 context:nil
(...skipping 11 matching lines...) Expand all
240 EXPECT_FALSE([bar_ hoverButtonForEvent:event]); 247 EXPECT_FALSE([bar_ hoverButtonForEvent:event]);
241 248
242 // Now! 249 // Now!
243 base::scoped_nsobject<GradientButtonCell> cell( 250 base::scoped_nsobject<GradientButtonCell> cell(
244 [[GradientButtonCell alloc] init]); 251 [[GradientButtonCell alloc] init]);
245 [button setCell:cell.get()]; 252 [button setCell:cell.get()];
246 EXPECT_TRUE([bar_ hoverButtonForEvent:nil]); 253 EXPECT_TRUE([bar_ hoverButtonForEvent:nil]);
247 } 254 }
248 255
249 } // namespace 256 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm ('k') | chrome/browser/ui/cocoa/translate/translate_bubble_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698