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. 4 5 #include "base/memory/scoped_nsobject.h" 6 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu.h" 7 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" 8 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/platform_test.h" 10 11 namespace { 12 13 class BookmarkMenuTest : public CocoaTest { 14 }; 15 16 TEST_F(BookmarkMenuTest, Basics) { 17 scoped_nsobject<BookmarkMenu> menu([[BookmarkMenu alloc] 18 initWithTitle:@"title"]); 19 scoped_nsobject<NSMenuItem> item([[NSMenuItem alloc] initWithTitle:@"item" 20 action:NULL 21 keyEquivalent:@""]); 22 [menu addItem:item]; 23 long long l = 103849459459598948LL; // arbitrary 24 NSNumber* number = [NSNumber numberWithLongLong:l]; 25 [menu setRepresentedObject:number]; 26 EXPECT_EQ(l, [menu id]); 27 } 28 29 } // namespace 30