OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 <AppKit/AppKit.h> | 5 #import <AppKit/AppKit.h> |
6 | 6 |
7 #include "base/strings/string16.h" | 7 #include "base/strings/string16.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
11 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h" | 11 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h" |
12 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 12 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
13 #include "chrome/grit/generated_resources.h" | 13 #include "chrome/grit/generated_resources.h" |
14 #include "chrome/test/base/testing_profile.h" | 14 #include "chrome/test/base/testing_profile.h" |
15 #include "components/bookmarks/browser/bookmark_model.h" | 15 #include "components/bookmarks/browser/bookmark_model.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 #import "testing/gtest_mac.h" | 17 #import "testing/gtest_mac.h" |
18 #include "testing/platform_test.h" | 18 #include "testing/platform_test.h" |
19 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
20 | 20 |
21 using base::ASCIIToUTF16; | 21 using base::ASCIIToUTF16; |
22 | 22 |
23 class TestBookmarkMenuBridge : public BookmarkMenuBridge { | 23 class TestBookmarkMenuBridge : public BookmarkMenuBridge { |
24 public: | 24 public: |
25 TestBookmarkMenuBridge(Profile* profile, NSMenu *menu) | 25 TestBookmarkMenuBridge(Profile* profile, NSMenu *menu) |
26 : BookmarkMenuBridge(profile, menu), | 26 : BookmarkMenuBridge(profile, menu), |
27 menu_(menu) { | 27 menu_(menu) { |
28 } | 28 } |
29 virtual ~TestBookmarkMenuBridge() { | 29 ~TestBookmarkMenuBridge() override { [menu_ autorelease]; } |
30 [menu_ autorelease]; | |
31 } | |
32 | 30 |
33 NSMenu* menu_; | 31 NSMenu* menu_; |
34 | 32 |
35 protected: | 33 protected: |
36 // Overridden from BookmarkMenuBridge. | 34 // Overridden from BookmarkMenuBridge. |
37 virtual NSMenu* BookmarkMenu() override { | 35 NSMenu* BookmarkMenu() override { return menu_; } |
38 return menu_; | |
39 } | |
40 }; | 36 }; |
41 | 37 |
42 // TODO(jrg): see refactor comment in bookmark_bar_state_controller_unittest.mm | 38 // TODO(jrg): see refactor comment in bookmark_bar_state_controller_unittest.mm |
43 class BookmarkMenuBridgeTest : public CocoaProfileTest { | 39 class BookmarkMenuBridgeTest : public CocoaProfileTest { |
44 public: | 40 public: |
45 | 41 |
46 virtual void SetUp() { | 42 virtual void SetUp() { |
47 CocoaProfileTest::SetUp(); | 43 CocoaProfileTest::SetUp(); |
48 ASSERT_TRUE(profile()); | 44 ASSERT_TRUE(profile()); |
49 | 45 |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 EXPECT_TRUE([item image]); | 391 EXPECT_TRUE([item image]); |
396 | 392 |
397 model->SetTitle(node, ASCIIToUTF16("New Title")); | 393 model->SetTitle(node, ASCIIToUTF16("New Title")); |
398 | 394 |
399 item = [menu itemWithTitle:@"Test Item"]; | 395 item = [menu itemWithTitle:@"Test Item"]; |
400 EXPECT_FALSE(item); | 396 EXPECT_FALSE(item); |
401 item = [menu itemWithTitle:@"New Title"]; | 397 item = [menu itemWithTitle:@"New Title"]; |
402 EXPECT_TRUE(item); | 398 EXPECT_TRUE(item); |
403 } | 399 } |
404 | 400 |
OLD | NEW |