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

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

Issue 209018: linux: expose the ProcessSingleton timeout to speed tests (Closed)
Patch Set: Created 11 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 (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 "chrome/browser/process_singleton.h" 5 #include "chrome/browser/process_singleton.h"
6 6
7 #include <sys/types.h> 7 #include <sys/types.h>
8 #include <sys/wait.h> 8 #include <sys/wait.h>
9 #include <signal.h> 9 #include <signal.h>
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 std::vector<std::string> argv; 51 std::vector<std::string> argv;
52 argv.push_back(old_argv_[0]); 52 argv.push_back(old_argv_[0]);
53 argv.push_back(url); 53 argv.push_back(url);
54 argv.push_back("--" + WideToASCII(switches::kNoProcessSingletonDialog)); 54 argv.push_back("--" + WideToASCII(switches::kNoProcessSingletonDialog));
55 55
56 CommandLine::Reset(); 56 CommandLine::Reset();
57 CommandLine::Init(argv); 57 CommandLine::Init(argv);
58 58
59 ProcessSingleton process_singleton(user_data_dir); 59 ProcessSingleton process_singleton(user_data_dir);
60 60
61 return process_singleton.NotifyOtherProcess(); 61 // Use a short timeout to keep tests fast.
62 const int kTimeoutSeconds = 1;
Paweł Hajdan Jr. 2009/09/17 19:45:56 I'd be a bit more conservative and put 3 instead o
63 return process_singleton.NotifyOtherProcessWithTimeout(kTimeoutSeconds);
62 } 64 }
63 65
64 std::vector<std::string> old_argv_; 66 std::vector<std::string> old_argv_;
65 }; 67 };
66 68
67 // Test if the socket file and symbol link created by ProcessSingletonLinux 69 // Test if the socket file and symbol link created by ProcessSingletonLinux
68 // are valid. When running this test, the ProcessSingleton object is already 70 // are valid. When running this test, the ProcessSingleton object is already
69 // initiated by UITest. So we just test against this existing object. 71 // initiated by UITest. So we just test against this existing object.
70 TEST_F(ProcessSingletonLinuxTest, CheckSocketFile) { 72 TEST_F(ProcessSingletonLinuxTest, CheckSocketFile) {
71 FilePath user_data_dir; 73 FilePath user_data_dir;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 // Wait for a while to make sure the browser process is actually killed. 149 // Wait for a while to make sure the browser process is actually killed.
148 EXPECT_FALSE(CrashAwareSleep(1000)); 150 EXPECT_FALSE(CrashAwareSleep(1000));
149 151
150 FilePath lock_path = user_data_dir().Append(chrome::kSingletonLockFilename); 152 FilePath lock_path = user_data_dir().Append(chrome::kSingletonLockFilename);
151 EXPECT_EQ(0, unlink(lock_path.value().c_str())); 153 EXPECT_EQ(0, unlink(lock_path.value().c_str()));
152 EXPECT_EQ(0, symlink("FAKEFOOHOST-1234", lock_path.value().c_str())); 154 EXPECT_EQ(0, symlink("FAKEFOOHOST-1234", lock_path.value().c_str()));
153 155
154 std::string url("about:blank"); 156 std::string url("about:blank");
155 EXPECT_EQ(ProcessSingleton::PROFILE_IN_USE, NotifyOtherProcess(url)); 157 EXPECT_EQ(ProcessSingleton::PROFILE_IN_USE, NotifyOtherProcess(url));
156 } 158 }
OLDNEW
« chrome/browser/process_singleton_linux.cc ('K') | « chrome/browser/process_singleton_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698