Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(947)

Side by Side Diff: chrome/browser/ui/views/status_icons/status_tray_win_unittest.cc

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698