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

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

Issue 2317123002: c/browser, c/common, components O-P: Change ScopedTempDir::path() to GetPath() (Closed)
Patch Set: Just rebased Created 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/process_singleton.h" 5 #include "chrome/browser/process_singleton.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <limits.h> 8 #include <limits.h>
9 #include <signal.h> 9 #include <signal.h>
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 79
80 void SetUp() override { 80 void SetUp() override {
81 testing::Test::SetUp(); 81 testing::Test::SetUp();
82 82
83 ProcessSingleton::DisablePromptForTesting(); 83 ProcessSingleton::DisablePromptForTesting();
84 // Put the lock in a temporary directory. Doesn't need to be a 84 // Put the lock in a temporary directory. Doesn't need to be a
85 // full profile to test this code. 85 // full profile to test this code.
86 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 86 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
87 // Use a long directory name to ensure that the socket isn't opened through 87 // Use a long directory name to ensure that the socket isn't opened through
88 // the symlink. 88 // the symlink.
89 user_data_path_ = temp_dir_.path().Append( 89 user_data_path_ = temp_dir_.GetPath().Append(
90 std::string(sizeof(sockaddr_un::sun_path), 'a')); 90 std::string(sizeof(sockaddr_un::sun_path), 'a'));
91 ASSERT_TRUE(CreateDirectory(user_data_path_)); 91 ASSERT_TRUE(CreateDirectory(user_data_path_));
92 92
93 lock_path_ = user_data_path_.Append(chrome::kSingletonLockFilename); 93 lock_path_ = user_data_path_.Append(chrome::kSingletonLockFilename);
94 socket_path_ = user_data_path_.Append(chrome::kSingletonSocketFilename); 94 socket_path_ = user_data_path_.Append(chrome::kSingletonSocketFilename);
95 cookie_path_ = user_data_path_.Append(chrome::kSingletonCookieFilename); 95 cookie_path_ = user_data_path_.Append(chrome::kSingletonCookieFilename);
96 } 96 }
97 97
98 void TearDown() override { 98 void TearDown() override {
99 scoped_refptr<base::ThreadTestHelper> io_helper(new base::ThreadTestHelper( 99 scoped_refptr<base::ThreadTestHelper> io_helper(new base::ThreadTestHelper(
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 // Test that if there is an existing lock file, and it's not locked, we replace 427 // Test that if there is an existing lock file, and it's not locked, we replace
428 // it. 428 // it.
429 TEST_F(ProcessSingletonPosixTest, CreateReplacesOldMacLock) { 429 TEST_F(ProcessSingletonPosixTest, CreateReplacesOldMacLock) {
430 std::unique_ptr<TestableProcessSingleton> process_singleton( 430 std::unique_ptr<TestableProcessSingleton> process_singleton(
431 CreateProcessSingleton()); 431 CreateProcessSingleton());
432 EXPECT_EQ(0, base::WriteFile(lock_path_, "", 0)); 432 EXPECT_EQ(0, base::WriteFile(lock_path_, "", 0));
433 EXPECT_TRUE(process_singleton->Create()); 433 EXPECT_TRUE(process_singleton->Create());
434 VerifyFiles(); 434 VerifyFiles();
435 } 435 }
436 #endif // defined(OS_MACOSX) 436 #endif // defined(OS_MACOSX)
OLDNEW
« no previous file with comments | « chrome/browser/process_singleton_posix.cc ('k') | chrome/browser/process_singleton_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698