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

Side by Side Diff: content/browser/browser_io_surface_manager_mac_unittest.cc

Issue 1351753002: Mac: Ensure that Mach messages always get a reply (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unit tests Created 5 years, 3 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "content/browser/browser_io_surface_manager_mac.h" 5 #include "content/browser/browser_io_surface_manager_mac.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace content { 9 namespace content {
10 10
(...skipping 13 matching lines...) Expand all
24 return io_surface_manager_.GenerateChildProcessToken(child_process_id); 24 return io_surface_manager_.GenerateChildProcessToken(child_process_id);
25 } 25 }
26 26
27 void InvalidateChildProcessToken(const IOSurfaceManagerToken& token) { 27 void InvalidateChildProcessToken(const IOSurfaceManagerToken& token) {
28 io_surface_manager_.InvalidateChildProcessToken(token); 28 io_surface_manager_.InvalidateChildProcessToken(token);
29 } 29 }
30 30
31 bool HandleRegisterIOSurfaceRequest( 31 bool HandleRegisterIOSurfaceRequest(
32 const IOSurfaceManagerHostMsg_RegisterIOSurface& request, 32 const IOSurfaceManagerHostMsg_RegisterIOSurface& request,
33 IOSurfaceManagerMsg_RegisterIOSurfaceReply* reply) { 33 IOSurfaceManagerMsg_RegisterIOSurfaceReply* reply) {
34 return io_surface_manager_.HandleRegisterIOSurfaceRequest(request, reply); 34 io_surface_manager_.HandleRegisterIOSurfaceRequest(request, reply);
35 return reply->result;
35 } 36 }
36 37
37 bool HandleUnregisterIOSurfaceRequest( 38 bool HandleUnregisterIOSurfaceRequest(
38 const IOSurfaceManagerHostMsg_UnregisterIOSurface& request) { 39 const IOSurfaceManagerHostMsg_UnregisterIOSurface& request) {
39 return io_surface_manager_.HandleUnregisterIOSurfaceRequest(request); 40 bool result = false;
41 io_surface_manager_.HandleUnregisterIOSurfaceRequest(request,
42 &result);
43 return result;
40 } 44 }
41 45
42 bool HandleAcquireIOSurfaceRequest( 46 bool HandleAcquireIOSurfaceRequest(
43 const IOSurfaceManagerHostMsg_AcquireIOSurface& request, 47 const IOSurfaceManagerHostMsg_AcquireIOSurface& request,
44 IOSurfaceManagerMsg_AcquireIOSurfaceReply* reply) { 48 IOSurfaceManagerMsg_AcquireIOSurfaceReply* reply) {
45 return io_surface_manager_.HandleAcquireIOSurfaceRequest(request, reply); 49 io_surface_manager_.HandleAcquireIOSurfaceRequest(request, reply);
50 return reply->result;
46 } 51 }
47 52
48 // Helper function used to register an IOSurface for testing. 53 // Helper function used to register an IOSurface for testing.
49 void RegisterIOSurface(const IOSurfaceManagerToken& gpu_process_token, 54 void RegisterIOSurface(const IOSurfaceManagerToken& gpu_process_token,
50 int io_surface_id, 55 int io_surface_id,
51 int client_id, 56 int client_id,
52 mach_port_t io_surface_port) { 57 mach_port_t io_surface_port) {
53 IOSurfaceManagerHostMsg_RegisterIOSurface request = {{0}}; 58 IOSurfaceManagerHostMsg_RegisterIOSurface request = {{0}};
54 IOSurfaceManagerMsg_RegisterIOSurfaceReply reply = {{0}}; 59 IOSurfaceManagerMsg_RegisterIOSurfaceReply reply = {{0}};
55 request.io_surface_id = io_surface_id; 60 request.io_surface_id = io_surface_id;
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 request.io_surface_id = kIOSurfaceId; 282 request.io_surface_id = kIOSurfaceId;
278 memcpy(request.token_name, child_process_token.name, 283 memcpy(request.token_name, child_process_token.name,
279 sizeof(child_process_token.name)); 284 sizeof(child_process_token.name));
280 EXPECT_TRUE(HandleAcquireIOSurfaceRequest(request, &reply)); 285 EXPECT_TRUE(HandleAcquireIOSurfaceRequest(request, &reply));
281 // Should return invalid port. 286 // Should return invalid port.
282 EXPECT_EQ(static_cast<mach_port_t>(MACH_PORT_NULL), 287 EXPECT_EQ(static_cast<mach_port_t>(MACH_PORT_NULL),
283 reply.io_surface_port.name); 288 reply.io_surface_port.name);
284 } 289 }
285 290
286 } // namespace content 291 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698