| 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 | |
| 21 class MenuControllerTest : public CocoaTest { | 19 class MenuControllerTest : public CocoaTest { |
| 22 }; | 20 }; |
| 23 | 21 |
| 24 // A menu delegate that counts the number of times certain things are called | 22 // A menu delegate that counts the number of times certain things are called |
| 25 // to make sure things are hooked up properly. | 23 // to make sure things are hooked up properly. |
| 26 class Delegate : public ui::SimpleMenuModel::Delegate { | 24 class Delegate : public ui::SimpleMenuModel::Delegate { |
| 27 public: | 25 public: |
| 28 Delegate() | 26 Delegate() |
| 29 : execute_count_(0), | 27 : execute_count_(0), |
| 30 enable_count_(0), | 28 enable_count_(0), |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 // the delegate. But since this is a test and there's no running MessageLoop, | 323 // the delegate. But since this is a test and there's no running MessageLoop, |
| 326 // |did_close_| will remain false until we pump the task manually. | 324 // |did_close_| will remain false until we pump the task manually. |
| 327 EXPECT_FALSE(delegate.did_close_); | 325 EXPECT_FALSE(delegate.did_close_); |
| 328 | 326 |
| 329 // Pump the task that notifies the delegate. | 327 // Pump the task that notifies the delegate. |
| 330 message_loop.RunAllPending(); | 328 message_loop.RunAllPending(); |
| 331 | 329 |
| 332 // Expect that the delegate got notified properly. | 330 // Expect that the delegate got notified properly. |
| 333 EXPECT_TRUE(delegate.did_close_); | 331 EXPECT_TRUE(delegate.did_close_); |
| 334 } | 332 } |
| 335 | |
| 336 } // namespace | |
| OLD | NEW |