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

Side by Side Diff: webrtc/modules/desktop_capture/win/cursor_unittest.cc

Issue 2685783014: Replace NULL with nullptr in all C++ files. (Closed)
Patch Set: Fixing android. Created 3 years, 10 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 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include <memory> 11 #include <memory>
12 12
13 #include "webrtc/modules/desktop_capture/desktop_frame.h" 13 #include "webrtc/modules/desktop_capture/desktop_frame.h"
14 #include "webrtc/modules/desktop_capture/desktop_geometry.h" 14 #include "webrtc/modules/desktop_capture/desktop_geometry.h"
15 #include "webrtc/modules/desktop_capture/mouse_cursor.h" 15 #include "webrtc/modules/desktop_capture/mouse_cursor.h"
16 #include "webrtc/modules/desktop_capture/win/cursor.h" 16 #include "webrtc/modules/desktop_capture/win/cursor.h"
17 #include "webrtc/modules/desktop_capture/win/cursor_unittest_resources.h" 17 #include "webrtc/modules/desktop_capture/win/cursor_unittest_resources.h"
18 #include "webrtc/modules/desktop_capture/win/scoped_gdi_object.h" 18 #include "webrtc/modules/desktop_capture/win/scoped_gdi_object.h"
19 #include "webrtc/test/gmock.h" 19 #include "webrtc/test/gmock.h"
20 20
21 namespace webrtc { 21 namespace webrtc {
22 22
23 namespace { 23 namespace {
24 24
25 // Loads |left| from resources, converts it to a |MouseCursor| instance and 25 // Loads |left| from resources, converts it to a |MouseCursor| instance and
26 // compares pixels with |right|. Returns true of MouseCursor bits match |right|. 26 // compares pixels with |right|. Returns true of MouseCursor bits match |right|.
27 // |right| must be a 32bpp cursor with alpha channel. 27 // |right| must be a 32bpp cursor with alpha channel.
28 bool ConvertToMouseShapeAndCompare(unsigned left, unsigned right) { 28 bool ConvertToMouseShapeAndCompare(unsigned left, unsigned right) {
29 HMODULE instance = GetModuleHandle(NULL); 29 HMODULE instance = GetModuleHandle(nullptr);
30 30
31 // Load |left| from the EXE module's resources. 31 // Load |left| from the EXE module's resources.
32 win::ScopedCursor cursor(reinterpret_cast<HCURSOR>( 32 win::ScopedCursor cursor(reinterpret_cast<HCURSOR>(
33 LoadImage(instance, MAKEINTRESOURCE(left), IMAGE_CURSOR, 0, 0, 0))); 33 LoadImage(instance, MAKEINTRESOURCE(left), IMAGE_CURSOR, 0, 0, 0)));
34 EXPECT_TRUE(cursor != NULL); 34 EXPECT_TRUE(cursor != nullptr);
35 35
36 // Convert |cursor| to |mouse_shape|. 36 // Convert |cursor| to |mouse_shape|.
37 HDC dc = GetDC(NULL); 37 HDC dc = GetDC(nullptr);
38 std::unique_ptr<MouseCursor> mouse_shape( 38 std::unique_ptr<MouseCursor> mouse_shape(
39 CreateMouseCursorFromHCursor(dc, cursor)); 39 CreateMouseCursorFromHCursor(dc, cursor));
40 ReleaseDC(NULL, dc); 40 ReleaseDC(nullptr, dc);
41 41
42 EXPECT_TRUE(mouse_shape.get()); 42 EXPECT_TRUE(mouse_shape.get());
43 43
44 // Load |right|. 44 // Load |right|.
45 cursor.Set(reinterpret_cast<HCURSOR>( 45 cursor.Set(reinterpret_cast<HCURSOR>(
46 LoadImage(instance, MAKEINTRESOURCE(right), IMAGE_CURSOR, 0, 0, 0))); 46 LoadImage(instance, MAKEINTRESOURCE(right), IMAGE_CURSOR, 0, 0, 0)));
47 47
48 ICONINFO iinfo; 48 ICONINFO iinfo;
49 EXPECT_TRUE(GetIconInfo(cursor, &iinfo)); 49 EXPECT_TRUE(GetIconInfo(cursor, &iinfo));
50 EXPECT_TRUE(iinfo.hbmColor); 50 EXPECT_TRUE(iinfo.hbmColor);
(...skipping 30 matching lines...) Expand all
81 IDD_CURSOR1_32BPP)); 81 IDD_CURSOR1_32BPP));
82 82
83 EXPECT_TRUE(ConvertToMouseShapeAndCompare(IDD_CURSOR2_1BPP, 83 EXPECT_TRUE(ConvertToMouseShapeAndCompare(IDD_CURSOR2_1BPP,
84 IDD_CURSOR2_32BPP)); 84 IDD_CURSOR2_32BPP));
85 85
86 EXPECT_TRUE(ConvertToMouseShapeAndCompare(IDD_CURSOR3_4BPP, 86 EXPECT_TRUE(ConvertToMouseShapeAndCompare(IDD_CURSOR3_4BPP,
87 IDD_CURSOR3_32BPP)); 87 IDD_CURSOR3_32BPP));
88 } 88 }
89 89
90 } // namespace webrtc 90 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698