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

Unified Diff: net/proxy/proxy_config_service_linux_unittest.cc

Issue 214036: Linux: fix a data race in a proxy config service unit test. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/proxy/proxy_config_service_linux.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/proxy/proxy_config_service_linux_unittest.cc
===================================================================
--- net/proxy/proxy_config_service_linux_unittest.cc (revision 26750)
+++ net/proxy/proxy_config_service_linux_unittest.cc (working copy)
@@ -254,13 +254,12 @@
Wait();
}
- // Does a reset, gconf setup and initial fetch of the proxy config,
+ // Does gconf setup and initial fetch of the proxy config,
// all on the calling thread (meant to be the thread with the
// default glib main loop, which is the UI thread).
void SetupAndInitialFetch() {
MessageLoop* file_loop = io_thread_.message_loop();
DCHECK_EQ(MessageLoop::TYPE_IO, file_loop->type());
- config_service_->Reset();
// We pass the mock IO thread as both the IO and file threads.
config_service_->SetupAndFetchInitialConfig(
MessageLoop::current(), io_thread_.message_loop(),
@@ -350,12 +349,6 @@
#define TEST_DESC(desc) StringPrintf("at line %d <%s>", __LINE__, desc)
TEST_F(ProxyConfigServiceLinuxTest, BasicGConfTest) {
- MockEnvironmentVariableGetter* env_getter =
- new MockEnvironmentVariableGetter;
- MockGConfSettingGetter* gconf_getter = new MockGConfSettingGetter;
- SynchConfigGetter sync_config_getter(
- new ProxyConfigServiceLinux(env_getter, gconf_getter));
-
std::vector<std::string> empty_ignores;
std::vector<std::string> google_ignores;
@@ -594,6 +587,11 @@
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
SCOPED_TRACE(StringPrintf("Test[%d] %s", i, tests[i].description.c_str()));
+ MockEnvironmentVariableGetter* env_getter =
+ new MockEnvironmentVariableGetter;
+ MockGConfSettingGetter* gconf_getter = new MockGConfSettingGetter;
+ SynchConfigGetter sync_config_getter(
+ new ProxyConfigServiceLinux(env_getter, gconf_getter));
ProxyConfig config;
gconf_getter->values = tests[i].values;
sync_config_getter.SetupAndInitialFetch();
@@ -609,12 +607,6 @@
}
TEST_F(ProxyConfigServiceLinuxTest, BasicEnvTest) {
- MockEnvironmentVariableGetter* env_getter =
- new MockEnvironmentVariableGetter;
- MockGConfSettingGetter* gconf_getter = new MockGConfSettingGetter;
- SynchConfigGetter sync_config_getter(
- new ProxyConfigServiceLinux(env_getter, gconf_getter));
-
// Inspired from proxy_config_service_win_unittest.cc.
const struct {
// Short description to identify the test
@@ -874,6 +866,11 @@
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
SCOPED_TRACE(StringPrintf("Test[%d] %s", i, tests[i].description.c_str()));
+ MockEnvironmentVariableGetter* env_getter =
+ new MockEnvironmentVariableGetter;
+ MockGConfSettingGetter* gconf_getter = new MockGConfSettingGetter;
+ SynchConfigGetter sync_config_getter(
+ new ProxyConfigServiceLinux(env_getter, gconf_getter));
ProxyConfig config;
env_getter->values = tests[i].values;
sync_config_getter.SetupAndInitialFetch();
@@ -912,13 +909,6 @@
}
TEST_F(ProxyConfigServiceLinuxTest, KDEConfigParser) {
- MockEnvironmentVariableGetter* env_getter =
- new MockEnvironmentVariableGetter;
- // Force the KDE getter to be used and tell it where the test is.
- env_getter->values.DESKTOP_SESSION = "kde";
- env_getter->values.KDE_HOME = kde_home_.value().c_str();
- SynchConfigGetter sync_config_getter(new ProxyConfigServiceLinux(env_getter));
-
// One of the tests below needs a worst-case long line prefix. We build it
// programmatically so that it will always be the right size.
std::string long_line;
@@ -1197,6 +1187,13 @@
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
SCOPED_TRACE(StringPrintf("Test[%d] %s", i, tests[i].description.c_str()));
+ MockEnvironmentVariableGetter* env_getter =
+ new MockEnvironmentVariableGetter;
+ // Force the KDE getter to be used and tell it where the test is.
+ env_getter->values.DESKTOP_SESSION = "kde";
+ env_getter->values.KDE_HOME = kde_home_.value().c_str();
+ SynchConfigGetter sync_config_getter(
+ new ProxyConfigServiceLinux(env_getter));
ProxyConfig config;
// Overwrite the kioslaverc file.
file_util::WriteFile(kioslaverc_, tests[i].kioslaverc.c_str(),
« no previous file with comments | « net/proxy/proxy_config_service_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698