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

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

Issue 137203005: Moved the ProxyPolicyProvider to the policy component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@BPC-3-dm-url-at-base
Patch Set: Created 6 years, 11 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/chromeos/policy/proxy_policy_provider.cc ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/policy/proxy_policy_provider_unittest.cc
diff --git a/chrome/browser/chromeos/policy/proxy_policy_provider_unittest.cc b/chrome/browser/chromeos/policy/proxy_policy_provider_unittest.cc
deleted file mode 100644
index 8c9d4280c89b241b8a35c876b55a1056efaff613..0000000000000000000000000000000000000000
--- a/chrome/browser/chromeos/policy/proxy_policy_provider_unittest.cc
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/basictypes.h"
-#include "base/callback.h"
-#include "chrome/browser/chromeos/policy/proxy_policy_provider.h"
-#include "components/policy/core/common/external_data_fetcher.h"
-#include "components/policy/core/common/mock_configuration_policy_provider.h"
-#include "components/policy/core/common/schema_registry.h"
-#include "testing/gmock/include/gmock/gmock.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-using testing::Mock;
-
-namespace policy {
-
-class ProxyPolicyProviderTest : public testing::Test {
- protected:
- ProxyPolicyProviderTest() {
- mock_provider_.Init();
- proxy_provider_.Init(&schema_registry_);
- proxy_provider_.AddObserver(&observer_);
- }
-
- virtual ~ProxyPolicyProviderTest() {
- proxy_provider_.RemoveObserver(&observer_);
- proxy_provider_.Shutdown();
- mock_provider_.Shutdown();
- }
-
- SchemaRegistry schema_registry_;
- MockConfigurationPolicyObserver observer_;
- MockConfigurationPolicyProvider mock_provider_;
- ProxyPolicyProvider proxy_provider_;
-
- static scoped_ptr<PolicyBundle> CopyBundle(const PolicyBundle& bundle) {
- scoped_ptr<PolicyBundle> copy(new PolicyBundle());
- copy->CopyFrom(bundle);
- return copy.Pass();
- }
-
- DISALLOW_COPY_AND_ASSIGN(ProxyPolicyProviderTest);
-};
-
-TEST_F(ProxyPolicyProviderTest, Init) {
- EXPECT_TRUE(proxy_provider_.IsInitializationComplete(POLICY_DOMAIN_CHROME));
- EXPECT_TRUE(PolicyBundle().Equals(proxy_provider_.policies()));
-}
-
-TEST_F(ProxyPolicyProviderTest, Delegate) {
- PolicyBundle bundle;
- bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()))
- .Set("policy",
- POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER,
- base::Value::CreateStringValue("value"),
- NULL);
- mock_provider_.UpdatePolicy(CopyBundle(bundle));
-
- EXPECT_CALL(observer_, OnUpdatePolicy(&proxy_provider_));
- proxy_provider_.SetDelegate(&mock_provider_);
- Mock::VerifyAndClearExpectations(&observer_);
- EXPECT_TRUE(bundle.Equals(proxy_provider_.policies()));
-
- EXPECT_CALL(observer_, OnUpdatePolicy(&proxy_provider_));
- bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()))
- .Set("policy",
- POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER,
- base::Value::CreateStringValue("new value"),
- NULL);
- mock_provider_.UpdatePolicy(CopyBundle(bundle));
- Mock::VerifyAndClearExpectations(&observer_);
- EXPECT_TRUE(bundle.Equals(proxy_provider_.policies()));
-
- EXPECT_CALL(observer_, OnUpdatePolicy(&proxy_provider_));
- proxy_provider_.SetDelegate(NULL);
- EXPECT_TRUE(PolicyBundle().Equals(proxy_provider_.policies()));
-}
-
-TEST_F(ProxyPolicyProviderTest, RefreshPolicies) {
- EXPECT_CALL(observer_, OnUpdatePolicy(&proxy_provider_));
- proxy_provider_.RefreshPolicies();
- Mock::VerifyAndClearExpectations(&observer_);
-
- EXPECT_CALL(observer_, OnUpdatePolicy(&proxy_provider_));
- proxy_provider_.SetDelegate(&mock_provider_);
- Mock::VerifyAndClearExpectations(&observer_);
-
- EXPECT_CALL(observer_, OnUpdatePolicy(&proxy_provider_)).Times(0);
- EXPECT_CALL(mock_provider_, RefreshPolicies());
- proxy_provider_.RefreshPolicies();
- Mock::VerifyAndClearExpectations(&observer_);
- Mock::VerifyAndClearExpectations(&mock_provider_);
-
- EXPECT_CALL(observer_, OnUpdatePolicy(&proxy_provider_));
- mock_provider_.UpdatePolicy(scoped_ptr<PolicyBundle>(new PolicyBundle()));
- Mock::VerifyAndClearExpectations(&observer_);
-}
-
-} // namespace policy
« no previous file with comments | « chrome/browser/chromeos/policy/proxy_policy_provider.cc ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698