OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "app/resource_bundle.h" | |
8 #include "base/sys_string_conversions.h" | 7 #include "base/sys_string_conversions.h" |
9 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 9 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
11 #include "chrome/browser/ui/cocoa/menu_controller.h" | 10 #include "chrome/browser/ui/cocoa/menu_controller.h" |
12 #include "grit/app_resources.h" | 11 #include "grit/app_resources.h" |
13 #include "grit/generated_resources.h" | 12 #include "grit/generated_resources.h" |
14 #include "third_party/skia/include/core/SkBitmap.h" | 13 #include "third_party/skia/include/core/SkBitmap.h" |
15 #include "ui/base/models/simple_menu_model.h" | 14 #include "ui/base/models/simple_menu_model.h" |
| 15 #include "ui/base/resource/resource_bundle.h" |
16 | 16 |
17 class MenuControllerTest : public CocoaTest { | 17 class MenuControllerTest : public CocoaTest { |
18 }; | 18 }; |
19 | 19 |
20 // A menu delegate that counts the number of times certain things are called | 20 // A menu delegate that counts the number of times certain things are called |
21 // to make sure things are hooked up properly. | 21 // to make sure things are hooked up properly. |
22 class Delegate : public ui::SimpleMenuModel::Delegate { | 22 class Delegate : public ui::SimpleMenuModel::Delegate { |
23 public: | 23 public: |
24 Delegate() : execute_count_(0), enable_count_(0) { } | 24 Delegate() : execute_count_(0), enable_count_(0) { } |
25 | 25 |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 Validate(menu.get(), [menu menu]); | 253 Validate(menu.get(), [menu menu]); |
254 EXPECT_EQ(second, base::SysNSStringToUTF16([item title])); | 254 EXPECT_EQ(second, base::SysNSStringToUTF16([item title])); |
255 EXPECT_TRUE([item image] != nil); | 255 EXPECT_TRUE([item image] != nil); |
256 | 256 |
257 // Now get rid of the icon and make sure it goes away. | 257 // Now get rid of the icon and make sure it goes away. |
258 delegate.SetDynamicIcon(NULL); | 258 delegate.SetDynamicIcon(NULL); |
259 Validate(menu.get(), [menu menu]); | 259 Validate(menu.get(), [menu menu]); |
260 EXPECT_EQ(second, base::SysNSStringToUTF16([item title])); | 260 EXPECT_EQ(second, base::SysNSStringToUTF16([item title])); |
261 EXPECT_EQ(nil, [item image]); | 261 EXPECT_EQ(nil, [item image]); |
262 } | 262 } |
OLD | NEW |