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

Unified Diff: remoting/host/policy_hack/policy_watcher_unittest.cc

Issue 746723002: Revert of Reporting of policy errors via host-offline-reason: part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 | « remoting/host/policy_hack/policy_watcher_linux.cc ('k') | remoting/host/remoting_me2me_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/policy_hack/policy_watcher_unittest.cc
diff --git a/remoting/host/policy_hack/policy_watcher_unittest.cc b/remoting/host/policy_hack/policy_watcher_unittest.cc
index cb9415485e8bc961f1d9678cfa0f2d9cbaa65a09..bef254c8cfcc973f6cd20111c3f394d694642e3d 100644
--- a/remoting/host/policy_hack/policy_watcher_unittest.cc
+++ b/remoting/host/policy_hack/policy_watcher_unittest.cc
@@ -24,12 +24,8 @@
void SetUp() override {
message_loop_proxy_ = base::MessageLoopProxy::current();
- policy_updated_callback_ = base::Bind(
- &MockPolicyCallback::OnPolicyUpdate,
- base::Unretained(&mock_policy_callback_));
- policy_error_callback_ = base::Bind(
- &MockPolicyCallback::OnPolicyError,
- base::Unretained(&mock_policy_callback_));
+ policy_callback_ = base::Bind(&MockPolicyCallback::OnPolicyUpdate,
+ base::Unretained(&mock_policy_callback_));
policy_watcher_.reset(new FakePolicyWatcher(message_loop_proxy_));
nat_true_.SetBoolean(PolicyWatcher::kNatPolicyName, true);
nat_false_.SetBoolean(PolicyWatcher::kNatPolicyName, false);
@@ -98,9 +94,7 @@
protected:
void StartWatching() {
- policy_watcher_->StartWatching(
- policy_updated_callback_,
- policy_error_callback_);
+ policy_watcher_->StartWatching(policy_callback_);
base::RunLoop().RunUntilIdle();
}
@@ -118,8 +112,7 @@
base::MessageLoop message_loop_;
scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
MockPolicyCallback mock_policy_callback_;
- PolicyWatcher::PolicyUpdatedCallback policy_updated_callback_;
- PolicyWatcher::PolicyErrorCallback policy_error_callback_;
+ PolicyWatcher::PolicyCallback policy_callback_;
scoped_ptr<FakePolicyWatcher> policy_watcher_;
base::DictionaryValue empty_;
base::DictionaryValue nat_true_;
@@ -411,42 +404,5 @@
StopWatching();
}
-const int kMaxTransientErrorRetries = 5;
-
-TEST_F(PolicyWatcherTest, SingleTransientErrorDoesntTriggerErrorCallback) {
- EXPECT_CALL(mock_policy_callback_, OnPolicyErrorPtr()).Times(0);
-
- StartWatching();
- policy_watcher_->SignalTransientErrorForTest();
- StopWatching();
-}
-
-TEST_F(PolicyWatcherTest, MultipleTransientErrorsTriggerErrorCallback) {
- EXPECT_CALL(mock_policy_callback_, OnPolicyErrorPtr());
-
- StartWatching();
- for (int i = 0; i < kMaxTransientErrorRetries; i++) {
- policy_watcher_->SignalTransientErrorForTest();
- }
- StopWatching();
-}
-
-TEST_F(PolicyWatcherTest, PolicyUpdateResetsTransientErrorsCounter) {
- testing::InSequence s;
- EXPECT_CALL(mock_policy_callback_,
- OnPolicyUpdatePtr(IsPolicies(&nat_true_others_default_)));
- EXPECT_CALL(mock_policy_callback_, OnPolicyErrorPtr()).Times(0);
-
- StartWatching();
- for (int i = 0; i < (kMaxTransientErrorRetries - 1); i++) {
- policy_watcher_->SignalTransientErrorForTest();
- }
- policy_watcher_->SetPolicies(&nat_true_);
- for (int i = 0; i < (kMaxTransientErrorRetries - 1); i++) {
- policy_watcher_->SignalTransientErrorForTest();
- }
- StopWatching();
-}
-
} // namespace policy_hack
} // namespace remoting
« no previous file with comments | « remoting/host/policy_hack/policy_watcher_linux.cc ('k') | remoting/host/remoting_me2me_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698