Chromium Code Reviews| Index: chrome/browser/metrics/variations/variations_service_unittest.cc |
| diff --git a/chrome/browser/metrics/variations/variations_service_unittest.cc b/chrome/browser/metrics/variations/variations_service_unittest.cc |
| index 468de78c7116f707ff5ff9e16fc6f241cb0261c8..1c1f70d9369d780201827c1093e8f7f87ab6457c 100644 |
| --- a/chrome/browser/metrics/variations/variations_service_unittest.cc |
| +++ b/chrome/browser/metrics/variations/variations_service_unittest.cc |
| @@ -19,6 +19,11 @@ |
| #include "net/url_request/test_url_fetcher_factory.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| +#if defined(OS_CHROMEOS) |
| +#include "chrome/browser/chromeos/settings/cros_settings.h" |
| +#include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h" |
| +#endif |
| + |
| namespace chrome_variations { |
| namespace { |
| @@ -378,9 +383,32 @@ TEST(VariationsServiceTest, VariationsURLIsValid) { |
| EXPECT_EQ(default_variations_url, |
| VariationsService::GetVariationsServerURL(&prefs).spec()); |
| +#if defined(OS_CHROMEOS) |
| + chromeos::StubCrosSettingsProvider stub_settings_provider; |
|
Alexei Svitkine (slow)
2013/04/17 21:24:36
I think it would be cleaner to do this in a separa
Mathieu
2013/04/18 19:17:19
Done.
|
| + chromeos::CrosSettings* cros_settings = chromeos::CrosSettings::Get(); |
|
Mattias Nissler (ping if slow)
2013/04/18 10:39:39
Sigh, CrosSettings mocking still sucks. Sorry abou
Mathieu
2013/04/18 19:17:19
Hey at least it works ;)
|
| + // Remove the real DeviceSettingsProvider and replace it with a stub that |
| + // allows modifications in a test. |
| + chromeos::CrosSettingsProvider* device_settings_provider = |
| + cros_settings->GetProvider(chromeos::kReportDeviceVersionInfo); |
|
Alexei Svitkine (slow)
2013/04/17 21:24:36
Indent 2 more.
Mathieu
2013/04/18 19:17:19
Done.
|
| + EXPECT_TRUE(device_settings_provider != NULL); |
| + EXPECT_TRUE(cros_settings->RemoveSettingsProvider(device_settings_provider)); |
| + cros_settings->AddSettingsProvider(&stub_settings_provider); |
| + |
| + cros_settings->SetString(chromeos::kVariationsRestrictParameter, |
| + "restricted"); |
| +#else |
| prefs.SetString(prefs::kVariationsRestrictParameter, "restricted"); |
| +#endif |
| + |
| EXPECT_EQ(default_variations_url + "?restrict=restricted", |
| VariationsService::GetVariationsServerURL(&prefs).spec()); |
| + |
| +#if defined(OS_CHROMEOS) |
| + // Restore the real DeviceSettingsProvider. |
| + EXPECT_TRUE( |
| + cros_settings->RemoveSettingsProvider(&stub_settings_provider)); |
|
Alexei Svitkine (slow)
2013/04/17 21:24:36
Indent 2 more.
Mathieu
2013/04/18 19:17:19
Done.
|
| + cros_settings->AddSettingsProvider(device_settings_provider); |
| +#endif |
| } |
| TEST(VariationsServiceTest, LoadSeed) { |