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

Unified Diff: chrome/browser/mach_broker_mac_unittest.cc

Issue 7232003: Move MachBroker to content. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/mach_broker_mac.cc ('k') | chrome/browser/prerender/prerender_contents.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/mach_broker_mac_unittest.cc
===================================================================
--- chrome/browser/mach_broker_mac_unittest.cc (revision 89953)
+++ chrome/browser/mach_broker_mac_unittest.cc (working copy)
@@ -1,60 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/mach_broker_mac.h"
-
-#include "base/synchronization/lock.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-class MachBrokerTest : public testing::Test {
- public:
- // Helper function to acquire/release locks and call |PlaceholderForPid()|.
- void AddPlaceholderForPid(base::ProcessHandle pid) {
- base::AutoLock lock(broker_.GetLock());
- broker_.AddPlaceholderForPid(pid);
- }
-
- // Helper function to acquire/release locks and call |FinalizePid()|.
- void FinalizePid(base::ProcessHandle pid,
- const MachBroker::MachInfo& mach_info) {
- base::AutoLock lock(broker_.GetLock());
- broker_.FinalizePid(pid, mach_info);
- }
-
- protected:
- MachBroker broker_;
-};
-
-TEST_F(MachBrokerTest, Locks) {
- // Acquire and release the locks. Nothing bad should happen.
- base::AutoLock lock(broker_.GetLock());
-}
-
-TEST_F(MachBrokerTest, AddPlaceholderAndFinalize) {
- // Add a placeholder for PID 1.
- AddPlaceholderForPid(1);
- EXPECT_EQ(0u, broker_.TaskForPid(1));
-
- // Finalize PID 1.
- FinalizePid(1, MachBroker::MachInfo().SetTask(100u));
- EXPECT_EQ(100u, broker_.TaskForPid(1));
-
- // Should be no entry for PID 2.
- EXPECT_EQ(0u, broker_.TaskForPid(2));
-}
-
-TEST_F(MachBrokerTest, Invalidate) {
- AddPlaceholderForPid(1);
- FinalizePid(1, MachBroker::MachInfo().SetTask(100u));
-
- EXPECT_EQ(100u, broker_.TaskForPid(1));
- broker_.InvalidatePid(1u);
- EXPECT_EQ(0u, broker_.TaskForPid(1));
-}
-
-TEST_F(MachBrokerTest, FinalizeUnknownPid) {
- // Finalizing an entry for an unknown pid should not add it to the map.
- FinalizePid(1u, MachBroker::MachInfo().SetTask(100u));
- EXPECT_EQ(0u, broker_.TaskForPid(1u));
-}
« no previous file with comments | « chrome/browser/mach_broker_mac.cc ('k') | chrome/browser/prerender/prerender_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698