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

Side by Side Diff: chrome/browser/process_singleton_mac_unittest.cc

Issue 11359217: Move scoped_temp_dir from base to base/files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <errno.h> 5 #include <errno.h>
6 #include <fcntl.h> 6 #include <fcntl.h>
7 #include <sys/file.h> 7 #include <sys/file.h>
8 8
9 #include "chrome/browser/process_singleton.h" 9 #include "chrome/browser/process_singleton.h"
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 return false; 54 return false;
55 55
56 // Someone else has the lock. 56 // Someone else has the lock.
57 if (errno == EWOULDBLOCK) 57 if (errno == EWOULDBLOCK)
58 return true; 58 return true;
59 59
60 EXPECT_EQ(EWOULDBLOCK, errno) << "Unexpected error acquiring lock."; 60 EXPECT_EQ(EWOULDBLOCK, errno) << "Unexpected error acquiring lock.";
61 return false; 61 return false;
62 } 62 }
63 63
64 ScopedTempDir temp_dir_; 64 base::ScopedTempDir temp_dir_;
65 FilePath lock_path_; 65 FilePath lock_path_;
66 }; 66 };
67 67
68 // Test that the base case doesn't blow up. 68 // Test that the base case doesn't blow up.
69 TEST_F(ProcessSingletonMacTest, Basic) { 69 TEST_F(ProcessSingletonMacTest, Basic) {
70 ProcessSingleton ps(temp_dir_.path()); 70 ProcessSingleton ps(temp_dir_.path());
71 EXPECT_FALSE(IsLocked()); 71 EXPECT_FALSE(IsLocked());
72 EXPECT_TRUE(ps.Create(ProcessSingleton::NotificationCallback())); 72 EXPECT_TRUE(ps.Create(ProcessSingleton::NotificationCallback()));
73 EXPECT_TRUE(IsLocked()); 73 EXPECT_TRUE(IsLocked());
74 ps.Cleanup(); 74 ps.Cleanup();
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 ps2.Cleanup(); 147 ps2.Cleanup();
148 EXPECT_FALSE(IsLocked()); 148 EXPECT_FALSE(IsLocked());
149 } 149 }
150 150
151 // TODO(shess): Test that the lock is released when the process dies. 151 // TODO(shess): Test that the lock is released when the process dies.
152 // DEATH_TEST? I don't know. If the code to communicate between 152 // DEATH_TEST? I don't know. If the code to communicate between
153 // browser processes is ever written, this all would need to be tested 153 // browser processes is ever written, this all would need to be tested
154 // more like the other platforms, in which case it would be easy. 154 // more like the other platforms, in which case it would be easy.
155 155
156 } // namespace 156 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/process_singleton_linux_unittest.cc ('k') | chrome/browser/profiles/profile_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698