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

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

Issue 1755973002: Move non-content specific parts of content::MachBroker into base::MachPortBroker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix component build. Created 4 years, 9 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/mach_broker_mac.h" 5 #include "content/browser/mach_broker_mac.h"
6 6
7 #include "base/synchronization/lock.h" 7 #include "base/synchronization/lock.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace content { 10 namespace content {
(...skipping 11 matching lines...) Expand all
22 } 22 }
23 23
24 int GetChildProcessCount(int child_process_id) { 24 int GetChildProcessCount(int child_process_id) {
25 return broker_.child_process_id_map_.count(child_process_id); 25 return broker_.child_process_id_map_.count(child_process_id);
26 } 26 }
27 27
28 // Helper function to acquire/release locks and call |FinalizePid()|. 28 // Helper function to acquire/release locks and call |FinalizePid()|.
29 void FinalizePid(base::ProcessHandle pid, 29 void FinalizePid(base::ProcessHandle pid,
30 mach_port_t task_port) { 30 mach_port_t task_port) {
31 base::AutoLock lock(broker_.GetLock()); 31 base::AutoLock lock(broker_.GetLock());
32 broker_.FinalizePid(pid, task_port); 32 broker_.broker_.FinalizePid(pid, task_port);
33 } 33 }
34 34
35 protected: 35 protected:
36 MachBroker broker_; 36 MachBroker broker_;
37 }; 37 };
38 38
39 TEST_F(MachBrokerTest, Locks) { 39 TEST_F(MachBrokerTest, Locks) {
40 // Acquire and release the locks. Nothing bad should happen. 40 // Acquire and release the locks. Nothing bad should happen.
41 base::AutoLock lock(broker_.GetLock()); 41 base::AutoLock lock(broker_.GetLock());
42 } 42 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 EXPECT_EQ(0, GetChildProcessCount(50)); 74 EXPECT_EQ(0, GetChildProcessCount(50));
75 } 75 }
76 76
77 TEST_F(MachBrokerTest, FinalizeUnknownPid) { 77 TEST_F(MachBrokerTest, FinalizeUnknownPid) {
78 // Finalizing an entry for an unknown pid should not add it to the map. 78 // Finalizing an entry for an unknown pid should not add it to the map.
79 FinalizePid(1u, 100u); 79 FinalizePid(1u, 100u);
80 EXPECT_EQ(0u, broker_.TaskForPid(1u)); 80 EXPECT_EQ(0u, broker_.TaskForPid(1u));
81 } 81 }
82 82
83 } // namespace content 83 } // namespace content
OLDNEW
« base/mac/mach_port_broker_unittest.cc ('K') | « content/browser/mach_broker_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698