| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "chrome/browser/status_icons/status_icon_menu_model.h" | 5 #include "chrome/browser/status_icons/status_icon_menu_model.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.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/browser/status_icons/status_icon.h" | 10 #include "chrome/browser/status_icons/status_icon.h" |
| 11 #include "chrome/browser/status_icons/status_tray.h" | 11 #include "chrome/browser/status_icons/status_tray.h" |
| 12 #include "grit/chrome_unscaled_resources.h" | 12 #include "grit/chrome_unscaled_resources.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "ui/base/accelerators/accelerator.h" | 14 #include "ui/base/accelerators/accelerator.h" |
| 15 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
| 16 #include "ui/gfx/image/image.h" | 16 #include "ui/gfx/image/image.h" |
| 17 | 17 |
| 18 using base::ASCIIToUTF16; |
| 19 |
| 18 class StatusIconMenuModelTest : public testing::Test, | 20 class StatusIconMenuModelTest : public testing::Test, |
| 19 public StatusIconMenuModel::Observer { | 21 public StatusIconMenuModel::Observer { |
| 20 public: | 22 public: |
| 21 virtual void SetUp() OVERRIDE { | 23 virtual void SetUp() OVERRIDE { |
| 22 menu_.reset(new StatusIconMenuModel(NULL)); | 24 menu_.reset(new StatusIconMenuModel(NULL)); |
| 23 menu_->AddObserver(this); | 25 menu_->AddObserver(this); |
| 24 changed_count_ = 0; | 26 changed_count_ = 0; |
| 25 } | 27 } |
| 26 | 28 |
| 27 virtual void TearDown() OVERRIDE { | 29 virtual void TearDown() OVERRIDE { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 111 |
| 110 // Ensure changes to one menu item does not affect the other menu item. | 112 // Ensure changes to one menu item does not affect the other menu item. |
| 111 EXPECT_FALSE(menu_model()->GetAcceleratorForCommandId(1, &accel_arg)); | 113 EXPECT_FALSE(menu_model()->GetAcceleratorForCommandId(1, &accel_arg)); |
| 112 EXPECT_EQ(base::string16(), menu_model()->GetLabelForCommandId(1)); | 114 EXPECT_EQ(base::string16(), menu_model()->GetLabelForCommandId(1)); |
| 113 EXPECT_EQ(base::string16(), menu_model()->GetSublabelForCommandId(0)); | 115 EXPECT_EQ(base::string16(), menu_model()->GetSublabelForCommandId(0)); |
| 114 EXPECT_FALSE(menu_model()->GetIconForCommandId(0, &image_arg)); | 116 EXPECT_FALSE(menu_model()->GetIconForCommandId(0, &image_arg)); |
| 115 | 117 |
| 116 // Menu state should have changed 8 times in this test. | 118 // Menu state should have changed 8 times in this test. |
| 117 EXPECT_EQ(8, changed_count()); | 119 EXPECT_EQ(8, changed_count()); |
| 118 } | 120 } |
| OLD | NEW |