summaryrefslogtreecommitdiffstats
path: root/net/proxy/proxy_config_service_linux_unittest.cc
diff options
context:
space:
mode:
authormdm@chromium.org <mdm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-22 18:13:20 +0000
committermdm@chromium.org <mdm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-22 18:13:20 +0000
commitc6e01dc7a346439ae64a00f9acd204025e17a218 (patch)
treea9b71c7253e3f3c5df9d4ebfa3be6789b387d1ea /net/proxy/proxy_config_service_linux_unittest.cc
parentaadcd1d93fc5f41fad7ccd22b97215bdd6bb7d5d (diff)
downloadchromium_src-c6e01dc7a346439ae64a00f9acd204025e17a218.zip
chromium_src-c6e01dc7a346439ae64a00f9acd204025e17a218.tar.gz
chromium_src-c6e01dc7a346439ae64a00f9acd204025e17a218.tar.bz2
Linux: fix a data race in a proxy config service unit test.
BUG=21474 TEST=none Review URL: http://codereview.chromium.org/214036 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26833 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy/proxy_config_service_linux_unittest.cc')
-rw-r--r--net/proxy/proxy_config_service_linux_unittest.cc39
1 files changed, 18 insertions, 21 deletions
diff --git a/net/proxy/proxy_config_service_linux_unittest.cc b/net/proxy/proxy_config_service_linux_unittest.cc
index 4eed20f..761b20a 100644
--- a/net/proxy/proxy_config_service_linux_unittest.cc
+++ b/net/proxy/proxy_config_service_linux_unittest.cc
@@ -254,13 +254,12 @@ class SynchConfigGetter {
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 @@ class ProxyConfigServiceLinuxTest : public PlatformTest {
#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 @@ TEST_F(ProxyConfigServiceLinuxTest, BasicGConfTest) {
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, BasicGConfTest) {
}
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 @@ TEST_F(ProxyConfigServiceLinuxTest, BasicEnvTest) {
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, GconfNotification) {
}
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 @@ TEST_F(ProxyConfigServiceLinuxTest, KDEConfigParser) {
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(),