Add ICU message format support
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / wrench_menu / menu_tracked_root_view_unittest.mm
blob924b9426c78d85545c4e71a44b8ea64893bdb335
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #import <Cocoa/Cocoa.h>
7 #include "base/mac/scoped_nsobject.h"
8 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
9 #import "chrome/browser/ui/cocoa/wrench_menu/menu_tracked_root_view.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "testing/platform_test.h"
12 #import "third_party/ocmock/OCMock/OCMock.h"
13 #include "third_party/ocmock/gtest_support.h"
15 class MenuTrackedRootViewTest : public CocoaTest {
16  public:
17   void SetUp() override {
18     CocoaTest::SetUp();
19     view_.reset([[MenuTrackedRootView alloc] init]);
20   }
22   base::scoped_nsobject<MenuTrackedRootView> view_;
25 TEST_F(MenuTrackedRootViewTest, MouseUp) {
26   id menu = [OCMockObject mockForClass:[NSMenu class]];
27   [[menu expect] cancelTracking];
29   id menuItem = [OCMockObject mockForClass:[NSMenuItem class]];
30   [[[menuItem stub] andReturn:menu] menu];
32   [view_ setMenuItem:menuItem];
33   NSEvent* event = [NSEvent mouseEventWithType:NSLeftMouseUp
34                                       location:NSMakePoint(42, 42)
35                                  modifierFlags:0
36                                      timestamp:0
37                                   windowNumber:[test_window() windowNumber]
38                                        context:nil
39                                    eventNumber:1
40                                     clickCount:1
41                                       pressure:1.0];
42   [view_ mouseUp:event];
44   EXPECT_OCMOCK_VERIFY(menu);
45   EXPECT_OCMOCK_VERIFY(menuItem);