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

Side by Side Diff: chrome/browser/cocoa/bookmark_bar_view_unittest.mm

Issue 155358: More bookmark bar changes.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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/cocoa/bookmark_bar_view.mm ('k') | chrome/browser/cocoa/bookmark_button_cell.mm » ('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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 // This file is intentionally empty; there is no code in 5 #import <Cocoa/Cocoa.h>
6 // BookmarkBarView to test yet. 6
7 #import "chrome/browser/cocoa/bookmark_bar_view.h"
8 #import "chrome/browser/cocoa/cocoa_test_helper.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10
11 class BookmarkBarViewTest : public testing::Test {
12 CocoaTestHelper cocoa_helper_; // Inits Cocoa, creates window, etc...
13 };
14
15 // Make sure we only get a menu from a right-click. Not left-click or keyDown.
16 TEST_F(BookmarkBarViewTest, TestMenu) {
17 scoped_nsobject<BookmarkBarView> view([[BookmarkBarView alloc]
18 initWithFrame:NSMakeRect(0,0,10,10)]);
19 EXPECT_TRUE(view.get());
20
21 // Not loaded from a nib so we must set it explicitly
22 scoped_nsobject<NSMenu> menu([[NSMenu alloc] initWithTitle:@"spork"]);
23 [view setContextMenu:menu.get()];
24
25 EXPECT_TRUE([view menuForEvent:[NSEvent mouseEventWithType:NSRightMouseDown
26 location:NSMakePoint(0,0)
27 modifierFlags:0
28 timestamp:0
29 windowNumber:0
30 context:nil
31 eventNumber:0
32 clickCount:0
33 pressure:0.0]]);
34 EXPECT_FALSE([view menuForEvent:[NSEvent mouseEventWithType:NSLeftMouseDown
35 location:NSMakePoint(0,0)
36 modifierFlags:0
37 timestamp:0
38 windowNumber:0
39 context:nil
40 eventNumber:0
41 clickCount:0
42 pressure:0.0]]);
43 EXPECT_FALSE([view menuForEvent:[NSEvent keyEventWithType:NSKeyDown
44 location:NSMakePoint(0,0)
45 modifierFlags:0
46 timestamp:0
47 windowNumber:0
48 context:nil
49 characters:@"x"
50 charactersIgnoringModifiers:@"x"
51 isARepeat:NO
52 keyCode:7]]);
53
54 [view setContextMenu:nil];
55 }
56
57
58
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/bookmark_bar_view.mm ('k') | chrome/browser/cocoa/bookmark_button_cell.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698