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

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: IRF 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 return io_surface_manager_.HandleUnregisterIOSurfaceRequest(request);
40 } 41 }
41 42
42 bool HandleAcquireIOSurfaceRequest( 43 bool HandleAcquireIOSurfaceRequest(
43 const IOSurfaceManagerHostMsg_AcquireIOSurface& request, 44 const IOSurfaceManagerHostMsg_AcquireIOSurface& request,
44 IOSurfaceManagerMsg_AcquireIOSurfaceReply* reply) { 45 IOSurfaceManagerMsg_AcquireIOSurfaceReply* reply) {
45 return io_surface_manager_.HandleAcquireIOSurfaceRequest(request, reply); 46 io_surface_manager_.HandleAcquireIOSurfaceRequest(request, reply);
47 return reply->result;
46 } 48 }
47 49
48 // Helper function used to register an IOSurface for testing. 50 // Helper function used to register an IOSurface for testing.
49 void RegisterIOSurface(const IOSurfaceManagerToken& gpu_process_token, 51 void RegisterIOSurface(const IOSurfaceManagerToken& gpu_process_token,
50 int io_surface_id, 52 int io_surface_id,
51 int client_id, 53 int client_id,
52 mach_port_t io_surface_port) { 54 mach_port_t io_surface_port) {
53 IOSurfaceManagerHostMsg_RegisterIOSurface request = {{0}}; 55 IOSurfaceManagerHostMsg_RegisterIOSurface request = {{0}};
54 IOSurfaceManagerMsg_RegisterIOSurfaceReply reply = {{0}}; 56 IOSurfaceManagerMsg_RegisterIOSurfaceReply reply = {{0}};
55 request.io_surface_id = io_surface_id; 57 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; 279 request.io_surface_id = kIOSurfaceId;
278 memcpy(request.token_name, child_process_token.name, 280 memcpy(request.token_name, child_process_token.name,
279 sizeof(child_process_token.name)); 281 sizeof(child_process_token.name));
280 EXPECT_TRUE(HandleAcquireIOSurfaceRequest(request, &reply)); 282 EXPECT_TRUE(HandleAcquireIOSurfaceRequest(request, &reply));
281 // Should return invalid port. 283 // Should return invalid port.
282 EXPECT_EQ(static_cast<mach_port_t>(MACH_PORT_NULL), 284 EXPECT_EQ(static_cast<mach_port_t>(MACH_PORT_NULL),
283 reply.io_surface_port.name); 285 reply.io_surface_port.name);
284 } 286 }
285 287
286 } // namespace content 288 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_io_surface_manager_mac.cc ('k') | content/child/child_io_surface_manager_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698