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

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

Issue 2056443002: Manual refactor to enum-based WaitableEvent for remaining mac/ios files (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@d_1_explicit_bools
Patch Set: Created 4 years, 6 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/command_line.h" 7 #include "base/command_line.h"
8 #include "base/synchronization/lock.h" 8 #include "base/synchronization/lock.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "base/test/multiprocess_test.h" 10 #include "base/test/multiprocess_test.h"
11 #include "base/test/test_timeouts.h" 11 #include "base/test/test_timeouts.h"
12 #include "content/public/test/test_browser_thread_bundle.h" 12 #include "content/public/test/test_browser_thread_bundle.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 #include "testing/multiprocess_func_list.h" 14 #include "testing/multiprocess_func_list.h"
15 15
16 namespace content { 16 namespace content {
17 17
18 class MachBrokerTest : public testing::Test, 18 class MachBrokerTest : public testing::Test,
19 public base::PortProvider::Observer { 19 public base::PortProvider::Observer {
20 public: 20 public:
21 MachBrokerTest() 21 MachBrokerTest()
22 : event_(true, false), received_process_(base::kNullProcessHandle) { 22 : event_(base::WaitableEvent::ResetPolicy::MANUAL,
23 base::WaitableEvent::InitialState::NOT_SIGNALED),
24 received_process_(base::kNullProcessHandle) {
23 broker_.AddObserver(this); 25 broker_.AddObserver(this);
24 } 26 }
25 ~MachBrokerTest() override { 27 ~MachBrokerTest() override {
26 broker_.RemoveObserver(this); 28 broker_.RemoveObserver(this);
27 } 29 }
28 30
29 // Helper function to acquire/release locks and call |PlaceholderForPid()|. 31 // Helper function to acquire/release locks and call |PlaceholderForPid()|.
30 void AddPlaceholderForPid(base::ProcessHandle pid, int child_process_id) { 32 void AddPlaceholderForPid(base::ProcessHandle pid, int child_process_id) {
31 base::AutoLock lock(broker_.GetLock()); 33 base::AutoLock lock(broker_.GetLock());
32 broker_.AddPlaceholderForPid(pid, child_process_id); 34 broker_.AddPlaceholderForPid(pid, child_process_id);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 EXPECT_EQ(static_cast<mach_port_t>(MACH_PORT_NULL), 104 EXPECT_EQ(static_cast<mach_port_t>(MACH_PORT_NULL),
103 broker_.TaskForPid(child_process.Handle() + 1)); 105 broker_.TaskForPid(child_process.Handle() + 1));
104 106
105 InvalidateChildProcessId(7); 107 InvalidateChildProcessId(7);
106 EXPECT_EQ(static_cast<mach_port_t>(MACH_PORT_NULL), 108 EXPECT_EQ(static_cast<mach_port_t>(MACH_PORT_NULL),
107 broker_.TaskForPid(child_process.Handle())); 109 broker_.TaskForPid(child_process.Handle()));
108 EXPECT_EQ(0, GetChildProcessCount(7)); 110 EXPECT_EQ(0, GetChildProcessCount(7));
109 } 111 }
110 112
111 } // namespace content 113 } // namespace content
OLDNEW
« no previous file with comments | « components/cronet/ios/test/quic_test_server.cc ('k') | ios/chrome/browser/browser_state/chrome_browser_state_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698