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

Unified Diff: chrome/browser/policy/cloud/mock_device_management_service.cc

Issue 25690003: Refactored the DeviceManagementService to get its parameters from a delegate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed comments Created 7 years, 2 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 | « chrome/browser/policy/cloud/mock_device_management_service.h ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/cloud/mock_device_management_service.cc
diff --git a/chrome/browser/policy/cloud/mock_device_management_service.cc b/chrome/browser/policy/cloud/mock_device_management_service.cc
index a11306f5b64efe227ae63e5878f960c3e8314d5c..c80b28b31f89b4d9c98f6db0c2f769bbbee3850e 100644
--- a/chrome/browser/policy/cloud/mock_device_management_service.cc
+++ b/chrome/browser/policy/cloud/mock_device_management_service.cc
@@ -16,6 +16,10 @@ namespace em = enterprise_management;
namespace policy {
namespace {
+const char kServerUrl[] = "https://example.com/management_service";
+const char kUserAgent[] = "Chrome 1.2.3(456)";
+const char kPlatform[] = "Test|Unit|1.2.3";
+
// Common mock request job functionality.
class MockRequestJobBase : public DeviceManagementRequestJob {
public:
@@ -118,14 +122,38 @@ ACTION_P2(CreateAsyncMockDeviceManagementJob, service, mock_job) {
MockDeviceManagementJob::~MockDeviceManagementJob() {}
+MockDeviceManagementServiceConfiguration::
+ MockDeviceManagementServiceConfiguration()
+ : server_url_(kServerUrl) {}
+
+MockDeviceManagementServiceConfiguration::
+ MockDeviceManagementServiceConfiguration(const std::string& server_url)
+ : server_url_(server_url) {}
+
+MockDeviceManagementServiceConfiguration::
+ ~MockDeviceManagementServiceConfiguration() {}
+
+std::string MockDeviceManagementServiceConfiguration::GetServerUrl() {
+ return server_url_;
+}
+
+std::string MockDeviceManagementServiceConfiguration::GetUserAgent() {
+ return kUserAgent;
+}
+
+std::string MockDeviceManagementServiceConfiguration::GetAgentParameter() {
+ return kUserAgent;
+}
+
+std::string MockDeviceManagementServiceConfiguration::GetPlatformParameter() {
+ return kPlatform;
+}
+
MockDeviceManagementService::MockDeviceManagementService()
- : DeviceManagementService(
- new net::TestURLRequestContextGetter(
- base::MessageLoopProxy::current()),
- std::string(),
- std::string(),
- std::string(),
- std::string()) {}
+ : DeviceManagementService(scoped_ptr<Configuration>(
+ new MockDeviceManagementServiceConfiguration),
+ new net::TestURLRequestContextGetter(
+ base::MessageLoopProxy::current())) {}
MockDeviceManagementService::~MockDeviceManagementService() {}
« no previous file with comments | « chrome/browser/policy/cloud/mock_device_management_service.h ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698