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

Unified Diff: chrome/browser/chromeos/policy/variations_service_policy_browsertest.cc

Issue 1313213005: Turn VariationsService::GetVariationsServerURL into instance method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use locally-constructed VariationsService in browsertests Created 5 years, 4 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
Index: chrome/browser/chromeos/policy/variations_service_policy_browsertest.cc
diff --git a/chrome/browser/chromeos/policy/variations_service_policy_browsertest.cc b/chrome/browser/chromeos/policy/variations_service_policy_browsertest.cc
index a997ec94fce13fa7dbe37d9cee4f906880d7746a..d2f8c404557468008522049a2bd10de129a62e04 100644
--- a/chrome/browser/chromeos/policy/variations_service_policy_browsertest.cc
+++ b/chrome/browser/chromeos/policy/variations_service_policy_browsertest.cc
@@ -6,8 +6,10 @@
#include "chrome/browser/chromeos/policy/device_policy_builder.h"
#include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h"
#include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h"
+#include "chrome/browser/metrics/variations/chrome_variations_service_client.h"
#include "chrome/browser/metrics/variations/variations_service.h"
#include "chrome/test/base/testing_browser_process.h"
+#include "components/web_resource/resource_request_allowed_notifier.h"
#include "net/base/url_util.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -41,8 +43,16 @@ IN_PROC_BROWSER_TEST_F(VariationsServiceDevicePolicyTest, VariationsURLValid) {
chrome_variations::VariationsService::
GetDefaultVariationsServerURLForTesting();
+ // g_browser_process->variations_service() is null by default in Chromium
+ // builds, so construct a VariationsService locally instead.
+ chrome_variations::VariationsService service(
+ make_scoped_ptr(new ChromeVariationsServiceClient()),
+ new web_resource::ResourceRequestAllowedNotifier(
+ g_browser_process->local_state(), nullptr),
Alexei Svitkine (slow) 2015/08/31 15:03:02 It's pretty weird that with the change to pass in
blundell 2015/09/01 10:03:06 Done.
+ g_browser_process->local_state(), NULL);
Alexei Svitkine (slow) 2015/08/31 15:03:02 nullptr
blundell 2015/09/01 10:03:06 Done.
+
// Device policy has updated the cros settings.
- const GURL url = chrome_variations::VariationsService::GetVariationsServerURL(
+ const GURL url = service.GetVariationsServerURL(
g_browser_process->local_state(), std::string());
EXPECT_TRUE(base::StartsWith(url.spec(), default_variations_url,
base::CompareCase::SENSITIVE));

Powered by Google App Engine
This is Rietveld 408576698