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 "chrome/browser/ui/views/status_icons/status_tray_win.h" | 5 #include "chrome/browser/ui/views/status_icons/status_tray_win.h" |
6 | 6 |
7 #include <commctrl.h> | 7 #include <commctrl.h> |
8 | 8 |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 } | 128 } |
129 #endif // !defined(USE_AURA) | 129 #endif // !defined(USE_AURA) |
130 | 130 |
131 TEST(StatusTrayWinTest, EnsureVisibleTest) { | 131 TEST(StatusTrayWinTest, EnsureVisibleTest) { |
132 StatusTrayWin tray; | 132 StatusTrayWin tray; |
133 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 133 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
134 gfx::ImageSkia* image = rb.GetImageSkiaNamed(IDR_STATUS_TRAY_ICON); | 134 gfx::ImageSkia* image = rb.GetImageSkiaNamed(IDR_STATUS_TRAY_ICON); |
135 | 135 |
136 FakeStatusTrayStateChangerProxy* proxy = | 136 FakeStatusTrayStateChangerProxy* proxy = |
137 new FakeStatusTrayStateChangerProxy(); | 137 new FakeStatusTrayStateChangerProxy(); |
138 tray.SetStatusTrayStateChangerProxyForTest(make_scoped_ptr(proxy)); | 138 tray.SetStatusTrayStateChangerProxyForTest( |
| 139 scoped_ptr<StatusTrayStateChangerProxy>(proxy)); |
139 | 140 |
140 StatusIconWin* icon = static_cast<StatusIconWin*>(tray.CreateStatusIcon( | 141 StatusIconWin* icon = static_cast<StatusIconWin*>(tray.CreateStatusIcon( |
141 StatusTray::OTHER_ICON, *image, base::ASCIIToUTF16("tool tip"))); | 142 StatusTray::OTHER_ICON, *image, base::ASCIIToUTF16("tool tip"))); |
142 | 143 |
143 icon->ForceVisible(); | 144 icon->ForceVisible(); |
| 145 // |proxy| is owned by |tray|, and |tray| lives to the end of the scope, |
| 146 // so calling methods on |proxy| is safe. |
144 EXPECT_TRUE(proxy->enqueue_called()); | 147 EXPECT_TRUE(proxy->enqueue_called()); |
145 EXPECT_EQ(proxy->window(), icon->window()); | 148 EXPECT_EQ(proxy->window(), icon->window()); |
146 EXPECT_EQ(proxy->icon_id(), icon->icon_id()); | 149 EXPECT_EQ(proxy->icon_id(), icon->icon_id()); |
147 } | 150 } |
OLD | NEW |