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

Unified Diff: chrome/browser/process_singleton_browsertest.cc

Issue 10161016: Convert ProcessSingleton ui_test to browser_test. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 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 | « no previous file | chrome/browser/process_singleton_uitest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/process_singleton_browsertest.cc
===================================================================
--- chrome/browser/process_singleton_browsertest.cc (revision 133238)
+++ chrome/browser/process_singleton_browsertest.cc (working copy)
@@ -10,9 +10,8 @@
// makes sense to test that the system services are giving the behavior we
// want?)
-#include <list>
-
#include "base/bind.h"
+#include "base/command_line.h"
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/memory/ref_counted.h"
@@ -26,8 +25,7 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/test_launcher_utils.h"
-#include "chrome/test/ui/ui_test.h"
-#include "testing/gtest/include/gtest/gtest.h"
+#include "chrome/test/base/in_process_browser_test.h"
namespace {
@@ -60,11 +58,9 @@
void StartChrome(base::WaitableEvent* start_event, bool first_run) {
// TODO(mattm): maybe stuff should be refactored to use
// UITest::LaunchBrowserHelper somehow?
- FilePath browser_directory;
- PathService::Get(chrome::DIR_APP, &browser_directory);
- CommandLine command_line(browser_directory.Append(
- chrome::kBrowserProcessExecutablePath));
-
+ FilePath program;
+ ASSERT_TRUE(PathService::Get(base::FILE_EXE, &program));
+ CommandLine command_line(program);
command_line.AppendSwitchPath(switches::kUserDataDir, user_data_dir_);
if (first_run)
@@ -130,8 +126,10 @@
DISALLOW_COPY_AND_ASSIGN(ChromeStarter);
};
+} // namespace
+
// Our test fixture that initializes and holds onto a few global vars.
-class ProcessSingletonTest : public UITest {
+class ProcessSingletonTest : public InProcessBrowserTest {
public:
ProcessSingletonTest()
// We use a manual reset so that all threads wake up at once when signaled
@@ -190,10 +188,12 @@
// But don't try more than kNbTries times...
static const int kNbTries = 10;
int num_tries = 0;
- while (base::GetProcessCount(chrome::kBrowserProcessExecutablePath,
- &process_tree_filter) > 0 && num_tries++ < kNbTries) {
- base::KillProcesses(chrome::kBrowserProcessExecutablePath,
- kExitCode, &process_tree_filter);
+ FilePath program;
+ ASSERT_TRUE(PathService::Get(base::FILE_EXE, &program));
+ FilePath::StringType exe_name = program.BaseName().value();
+ while (base::GetProcessCount(exe_name, &process_tree_filter) > 0 &&
+ num_tries++ < kNbTries) {
+ base::KillProcesses(exe_name, kExitCode, &process_tree_filter);
}
DLOG_IF(ERROR, num_tries >= kNbTries) << "Failed to kill all processes!";
}
@@ -223,7 +223,7 @@
#else
#define MAYBE_StartupRaceCondition StartupRaceCondition
#endif
-TEST_F(ProcessSingletonTest, MAYBE_StartupRaceCondition) {
+IN_PROC_BROWSER_TEST_F(ProcessSingletonTest, MAYBE_StartupRaceCondition) {
// We use this to stop the attempts loop on the first failure.
bool failed = false;
for (size_t attempt = 0; attempt < kNbAttempts && !failed; ++attempt) {
@@ -323,5 +323,3 @@
}
}
}
-
-} // namespace
« no previous file with comments | « no previous file | chrome/browser/process_singleton_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698