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

Side by Side Diff: components/policy/core/common/policy_provider_android_unittest.cc

Issue 388963002: Get rid of the rest of CreateStringValue (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix bad rebase Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "components/policy/core/common/policy_provider_android.h" 6 #include "components/policy/core/common/policy_provider_android.h"
7 #include "components/policy/core/common/policy_provider_android_delegate.h" 7 #include "components/policy/core/common/policy_provider_android_delegate.h"
8 #include "testing/gmock/include/gmock/gmock.h" 8 #include "testing/gmock/include/gmock/gmock.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 namespace policy { 11 namespace policy {
12 12
13 namespace { 13 namespace {
14 14
15 // Helper to write a policy in |bundle| with less code. 15 // Helper to write a policy in |bundle| with less code.
16 void SetPolicy(PolicyBundle* bundle, 16 void SetPolicy(PolicyBundle* bundle,
17 const std::string& name, 17 const std::string& name,
18 const std::string& value) { 18 const std::string& value) {
19 bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) 19 bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()))
20 .Set(name, 20 .Set(name,
21 POLICY_LEVEL_MANDATORY, 21 POLICY_LEVEL_MANDATORY,
22 POLICY_SCOPE_USER, 22 POLICY_SCOPE_USER,
23 base::Value::CreateStringValue(value), 23 new base::StringValue(value),
24 NULL); 24 NULL);
25 } 25 }
26 26
27 class MockPolicyProviderAndroidDelegate : public PolicyProviderAndroidDelegate { 27 class MockPolicyProviderAndroidDelegate : public PolicyProviderAndroidDelegate {
28 public: 28 public:
29 MockPolicyProviderAndroidDelegate() {} 29 MockPolicyProviderAndroidDelegate() {}
30 virtual ~MockPolicyProviderAndroidDelegate() {} 30 virtual ~MockPolicyProviderAndroidDelegate() {}
31 31
32 MOCK_METHOD0(RefreshPolicies, void()); 32 MOCK_METHOD0(RefreshPolicies, void());
33 MOCK_METHOD0(PolicyProviderShutdown, void()); 33 MOCK_METHOD0(PolicyProviderShutdown, void());
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 policy_bundle.reset(new PolicyBundle); 119 policy_bundle.reset(new PolicyBundle);
120 SetPolicy(policy_bundle.get(), "key", "new_value"); 120 SetPolicy(policy_bundle.get(), "key", "new_value");
121 expected_policy_bundle.CopyFrom(*policy_bundle); 121 expected_policy_bundle.CopyFrom(*policy_bundle);
122 provider.Get()->SetPolicies(policy_bundle.Pass()); 122 provider.Get()->SetPolicies(policy_bundle.Pass());
123 EXPECT_TRUE(provider.Get()->policies().Equals(expected_policy_bundle)); 123 EXPECT_TRUE(provider.Get()->policies().Equals(expected_policy_bundle));
124 124
125 EXPECT_CALL(delegate, PolicyProviderShutdown()).Times(1); 125 EXPECT_CALL(delegate, PolicyProviderShutdown()).Times(1);
126 } 126 }
127 127
128 } // namespace policy 128 } // namespace policy
OLDNEW
« no previous file with comments | « components/policy/core/common/policy_map_unittest.cc ('k') | components/policy/core/common/policy_service_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698