OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 10 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
11 #include "chrome/browser/ui/cocoa/menu_controller.h" | 11 #include "chrome/browser/ui/cocoa/menu_controller.h" |
12 #include "grit/generated_resources.h" | 12 #include "grit/generated_resources.h" |
13 #include "grit/ui_resources_standard.h" | 13 #include "grit/ui_resources_standard.h" |
14 #include "third_party/skia/include/core/SkBitmap.h" | 14 #include "third_party/skia/include/core/SkBitmap.h" |
15 #include "ui/base/models/simple_menu_model.h" | 15 #include "ui/base/models/simple_menu_model.h" |
16 #include "ui/base/resource/resource_bundle.h" | 16 #include "ui/base/resource/resource_bundle.h" |
17 #include "ui/gfx/image/image_skia.h" | 17 #include "ui/gfx/image/image_skia.h" |
18 | 18 |
| 19 namespace { |
| 20 |
19 class MenuControllerTest : public CocoaTest { | 21 class MenuControllerTest : public CocoaTest { |
20 }; | 22 }; |
21 | 23 |
22 // A menu delegate that counts the number of times certain things are called | 24 // A menu delegate that counts the number of times certain things are called |
23 // to make sure things are hooked up properly. | 25 // to make sure things are hooked up properly. |
24 class Delegate : public ui::SimpleMenuModel::Delegate { | 26 class Delegate : public ui::SimpleMenuModel::Delegate { |
25 public: | 27 public: |
26 Delegate() | 28 Delegate() |
27 : execute_count_(0), | 29 : execute_count_(0), |
28 enable_count_(0), | 30 enable_count_(0), |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 // the delegate. But since this is a test and there's no running MessageLoop, | 325 // the delegate. But since this is a test and there's no running MessageLoop, |
324 // |did_close_| will remain false until we pump the task manually. | 326 // |did_close_| will remain false until we pump the task manually. |
325 EXPECT_FALSE(delegate.did_close_); | 327 EXPECT_FALSE(delegate.did_close_); |
326 | 328 |
327 // Pump the task that notifies the delegate. | 329 // Pump the task that notifies the delegate. |
328 message_loop.RunAllPending(); | 330 message_loop.RunAllPending(); |
329 | 331 |
330 // Expect that the delegate got notified properly. | 332 // Expect that the delegate got notified properly. |
331 EXPECT_TRUE(delegate.did_close_); | 333 EXPECT_TRUE(delegate.did_close_); |
332 } | 334 } |
| 335 |
| 336 } // namespace |
OLD | NEW |