| 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 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 TEST(StatusTrayWinTest, CreateTray) { | 69 TEST(StatusTrayWinTest, CreateTray) { |
| 70 // Just tests creation/destruction. | 70 // Just tests creation/destruction. |
| 71 StatusTrayWin tray; | 71 StatusTrayWin tray; |
| 72 } | 72 } |
| 73 | 73 |
| 74 TEST(StatusTrayWinTest, CreateIconAndMenu) { | 74 TEST(StatusTrayWinTest, CreateIconAndMenu) { |
| 75 // Create an icon, set the images, tooltip, and context menu, then shut it | 75 // Create an icon, set the images, tooltip, and context menu, then shut it |
| 76 // down. | 76 // down. |
| 77 StatusTrayWin tray; | 77 StatusTrayWin tray; |
| 78 StatusIcon* icon = CreateStatusIcon(&tray); | 78 StatusIcon* icon = CreateStatusIcon(&tray); |
| 79 scoped_ptr<StatusIconMenuModel> menu(new StatusIconMenuModel(NULL)); | 79 std::unique_ptr<StatusIconMenuModel> menu(new StatusIconMenuModel(NULL)); |
| 80 menu->AddItem(0, L"foo"); | 80 menu->AddItem(0, L"foo"); |
| 81 icon->SetContextMenu(std::move(menu)); | 81 icon->SetContextMenu(std::move(menu)); |
| 82 } | 82 } |
| 83 | 83 |
| 84 #if !defined(USE_AURA) // http://crbug.com/156370 | 84 #if !defined(USE_AURA) // http://crbug.com/156370 |
| 85 TEST(StatusTrayWinTest, ClickOnIcon) { | 85 TEST(StatusTrayWinTest, ClickOnIcon) { |
| 86 // Create an icon, send a fake click event, make sure observer is called. | 86 // Create an icon, send a fake click event, make sure observer is called. |
| 87 StatusTrayWin tray; | 87 StatusTrayWin tray; |
| 88 | 88 |
| 89 StatusIconWin* icon = CreateStatusIcon(&tray); | 89 StatusIconWin* icon = CreateStatusIcon(&tray); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 120 tray.WndProc(NULL, message_id, icon_id, WM_LBUTTONDOWN); | 120 tray.WndProc(NULL, message_id, icon_id, WM_LBUTTONDOWN); |
| 121 } | 121 } |
| 122 #endif // !defined(USE_AURA) | 122 #endif // !defined(USE_AURA) |
| 123 | 123 |
| 124 TEST(StatusTrayWinTest, EnsureVisibleTest) { | 124 TEST(StatusTrayWinTest, EnsureVisibleTest) { |
| 125 StatusTrayWin tray; | 125 StatusTrayWin tray; |
| 126 | 126 |
| 127 FakeStatusTrayStateChangerProxy* proxy = | 127 FakeStatusTrayStateChangerProxy* proxy = |
| 128 new FakeStatusTrayStateChangerProxy(); | 128 new FakeStatusTrayStateChangerProxy(); |
| 129 tray.SetStatusTrayStateChangerProxyForTest( | 129 tray.SetStatusTrayStateChangerProxyForTest( |
| 130 scoped_ptr<StatusTrayStateChangerProxy>(proxy)); | 130 std::unique_ptr<StatusTrayStateChangerProxy>(proxy)); |
| 131 | 131 |
| 132 StatusIconWin* icon = CreateStatusIcon(&tray); | 132 StatusIconWin* icon = CreateStatusIcon(&tray); |
| 133 | 133 |
| 134 icon->ForceVisible(); | 134 icon->ForceVisible(); |
| 135 // |proxy| is owned by |tray|, and |tray| lives to the end of the scope, | 135 // |proxy| is owned by |tray|, and |tray| lives to the end of the scope, |
| 136 // so calling methods on |proxy| is safe. | 136 // so calling methods on |proxy| is safe. |
| 137 EXPECT_TRUE(proxy->enqueue_called()); | 137 EXPECT_TRUE(proxy->enqueue_called()); |
| 138 EXPECT_EQ(proxy->window(), icon->window()); | 138 EXPECT_EQ(proxy->window(), icon->window()); |
| 139 EXPECT_EQ(proxy->icon_id(), icon->icon_id()); | 139 EXPECT_EQ(proxy->icon_id(), icon->icon_id()); |
| 140 } | 140 } |
| OLD | NEW |