| 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 #include "base/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
| 6 #include "base/strings/string_util.h" | 6 #include "base/strings/string_util.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/status_icons/status_icon.h" | 8 #include "chrome/browser/status_icons/status_icon.h" |
| 9 #include "chrome/browser/status_icons/status_tray.h" | 9 #include "chrome/browser/status_icons/status_tray.h" |
| 10 #include "grit/chrome_unscaled_resources.h" | 10 #include "grit/chrome_unscaled_resources.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 const StatusIcons& GetStatusIconsForTest() const { return status_icons(); } | 35 const StatusIcons& GetStatusIconsForTest() const { return status_icons(); } |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 TEST(StatusTrayTest, Create) { | 38 TEST(StatusTrayTest, Create) { |
| 39 // Check for creation and leaks. | 39 // Check for creation and leaks. |
| 40 TestStatusTray tray; | 40 TestStatusTray tray; |
| 41 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 41 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 42 gfx::ImageSkia* image = rb.GetImageSkiaNamed(IDR_STATUS_TRAY_ICON); | 42 gfx::ImageSkia* image = rb.GetImageSkiaNamed(IDR_STATUS_TRAY_ICON); |
| 43 tray.CreateStatusIcon( | 43 tray.CreateStatusIcon( |
| 44 StatusTray::OTHER_ICON, *image, ASCIIToUTF16("tool tip")); | 44 StatusTray::OTHER_ICON, *image, base::ASCIIToUTF16("tool tip")); |
| 45 EXPECT_EQ(1U, tray.GetStatusIconsForTest().size()); | 45 EXPECT_EQ(1U, tray.GetStatusIconsForTest().size()); |
| 46 } | 46 } |
| 47 | 47 |
| 48 // Make sure that removing an icon removes it from the list. | 48 // Make sure that removing an icon removes it from the list. |
| 49 TEST(StatusTrayTest, CreateRemove) { | 49 TEST(StatusTrayTest, CreateRemove) { |
| 50 TestStatusTray tray; | 50 TestStatusTray tray; |
| 51 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 51 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 52 gfx::ImageSkia* image = rb.GetImageSkiaNamed(IDR_STATUS_TRAY_ICON); | 52 gfx::ImageSkia* image = rb.GetImageSkiaNamed(IDR_STATUS_TRAY_ICON); |
| 53 StatusIcon* icon = tray.CreateStatusIcon( | 53 StatusIcon* icon = tray.CreateStatusIcon( |
| 54 StatusTray::OTHER_ICON, *image, ASCIIToUTF16("tool tip")); | 54 StatusTray::OTHER_ICON, *image, base::ASCIIToUTF16("tool tip")); |
| 55 EXPECT_EQ(1U, tray.GetStatusIconsForTest().size()); | 55 EXPECT_EQ(1U, tray.GetStatusIconsForTest().size()); |
| 56 tray.RemoveStatusIcon(icon); | 56 tray.RemoveStatusIcon(icon); |
| 57 EXPECT_EQ(0U, tray.GetStatusIconsForTest().size()); | 57 EXPECT_EQ(0U, tray.GetStatusIconsForTest().size()); |
| 58 } | 58 } |
| OLD | NEW |