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

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

Issue 886913002: Always run PolicyWatcher on UI thread in It2Me host. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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 a04fe87a1e0260bbebeab4bb1ed280543bc904b8..dd79e2210712dd0b1cd5cc96576187a4fbe155fb 100644
--- a/remoting/host/policy_hack/policy_watcher_unittest.cc
+++ b/remoting/host/policy_hack/policy_watcher_unittest.cc
@@ -34,8 +34,8 @@ class PolicyWatcherTest : public testing::Test {
// Retaining a raw pointer to keep control over policy contents.
policy_loader_ = new policy::FakeAsyncPolicyLoader(message_loop_proxy_);
- policy_watcher_ = PolicyWatcher::CreateFromPolicyLoader(
- message_loop_proxy_, make_scoped_ptr(policy_loader_));
+ policy_watcher_ =
+ PolicyWatcher::CreateFromPolicyLoader(make_scoped_ptr(policy_loader_));
nat_true_.SetBoolean(policy::key::kRemoteAccessHostFirewallTraversal, true);
nat_false_.SetBoolean(policy::key::kRemoteAccessHostFirewallTraversal,
@@ -128,13 +128,6 @@ class PolicyWatcherTest : public testing::Test {
base::RunLoop().RunUntilIdle();
}
- void StopWatching() {
- EXPECT_CALL(*this, PostPolicyWatcherShutdown()).Times(1);
- policy_watcher_->StopWatching(base::Bind(
- &PolicyWatcherTest::PostPolicyWatcherShutdown, base::Unretained(this)));
- base::RunLoop().RunUntilIdle();
- }
-
void SetPolicies(const base::DictionaryValue& dict) {
// Copy |dict| into |policy_bundle|.
policy::PolicyNamespace policy_namespace =
@@ -249,7 +242,6 @@ TEST_F(PolicyWatcherTest, None) {
SetPolicies(empty_);
StartWatching();
- StopWatching();
}
TEST_F(PolicyWatcherTest, NatTrue) {
@@ -258,7 +250,6 @@ TEST_F(PolicyWatcherTest, NatTrue) {
SetPolicies(nat_true_);
StartWatching();
- StopWatching();
}
TEST_F(PolicyWatcherTest, NatFalse) {
@@ -267,7 +258,6 @@ TEST_F(PolicyWatcherTest, NatFalse) {
SetPolicies(nat_false_);
StartWatching();
- StopWatching();
}
TEST_F(PolicyWatcherTest, NatOne) {
@@ -276,7 +266,6 @@ TEST_F(PolicyWatcherTest, NatOne) {
SetPolicies(nat_one_);
StartWatching();
- StopWatching();
}
TEST_F(PolicyWatcherTest, DomainEmpty) {
@@ -285,7 +274,6 @@ TEST_F(PolicyWatcherTest, DomainEmpty) {
SetPolicies(domain_empty_);
StartWatching();
- StopWatching();
}
TEST_F(PolicyWatcherTest, DomainFull) {
@@ -294,7 +282,6 @@ TEST_F(PolicyWatcherTest, DomainFull) {
SetPolicies(domain_full_);
StartWatching();
- StopWatching();
}
TEST_F(PolicyWatcherTest, NatNoneThenTrue) {
@@ -304,7 +291,6 @@ TEST_F(PolicyWatcherTest, NatNoneThenTrue) {
SetPolicies(empty_);
StartWatching();
SetPolicies(nat_true_);
- StopWatching();
}
TEST_F(PolicyWatcherTest, NatNoneThenTrueThenTrue) {
@@ -315,7 +301,6 @@ TEST_F(PolicyWatcherTest, NatNoneThenTrueThenTrue) {
StartWatching();
SetPolicies(nat_true_);
SetPolicies(nat_true_);
- StopWatching();
}
TEST_F(PolicyWatcherTest, NatNoneThenTrueThenTrueThenFalse) {
@@ -330,7 +315,6 @@ TEST_F(PolicyWatcherTest, NatNoneThenTrueThenTrueThenFalse) {
SetPolicies(nat_true_);
SetPolicies(nat_true_);
SetPolicies(nat_false_);
- StopWatching();
}
TEST_F(PolicyWatcherTest, NatNoneThenFalse) {
@@ -343,7 +327,6 @@ TEST_F(PolicyWatcherTest, NatNoneThenFalse) {
SetPolicies(empty_);
StartWatching();
SetPolicies(nat_false_);
- StopWatching();
}
TEST_F(PolicyWatcherTest, NatNoneThenFalseThenTrue) {
@@ -359,7 +342,6 @@ TEST_F(PolicyWatcherTest, NatNoneThenFalseThenTrue) {
StartWatching();
SetPolicies(nat_false_);
SetPolicies(nat_true_);
- StopWatching();
}
TEST_F(PolicyWatcherTest, ChangeOneRepeatedlyThenTwo) {
@@ -382,7 +364,6 @@ TEST_F(PolicyWatcherTest, ChangeOneRepeatedlyThenTwo) {
SetPolicies(nat_false_domain_full_);
SetPolicies(nat_false_domain_empty_);
SetPolicies(nat_true_domain_full_);
- StopWatching();
}
TEST_F(PolicyWatcherTest, FilterUnknownPolicies) {
@@ -394,7 +375,6 @@ TEST_F(PolicyWatcherTest, FilterUnknownPolicies) {
StartWatching();
SetPolicies(unknown_policies_);
SetPolicies(empty_);
- StopWatching();
}
TEST_F(PolicyWatcherTest, DebugOverrideNatPolicy) {
@@ -409,7 +389,6 @@ TEST_F(PolicyWatcherTest, DebugOverrideNatPolicy) {
SetPolicies(nat_true_and_overridden_);
StartWatching();
- StopWatching();
}
TEST_F(PolicyWatcherTest, PairingFalseThenTrue) {
@@ -425,7 +404,6 @@ TEST_F(PolicyWatcherTest, PairingFalseThenTrue) {
StartWatching();
SetPolicies(pairing_false_);
SetPolicies(pairing_true_);
- StopWatching();
}
TEST_F(PolicyWatcherTest, GnubbyAuth) {
@@ -441,7 +419,6 @@ TEST_F(PolicyWatcherTest, GnubbyAuth) {
StartWatching();
SetPolicies(gnubby_auth_false_);
SetPolicies(gnubby_auth_true_);
- StopWatching();
}
TEST_F(PolicyWatcherTest, Relay) {
@@ -457,7 +434,6 @@ TEST_F(PolicyWatcherTest, Relay) {
StartWatching();
SetPolicies(relay_false_);
SetPolicies(relay_true_);
- StopWatching();
}
TEST_F(PolicyWatcherTest, UdpPortRange) {
@@ -473,7 +449,6 @@ TEST_F(PolicyWatcherTest, UdpPortRange) {
StartWatching();
SetPolicies(port_range_full_);
SetPolicies(port_range_empty_);
- StopWatching();
}
const int kMaxTransientErrorRetries = 5;
@@ -483,7 +458,6 @@ TEST_F(PolicyWatcherTest, SingleTransientErrorDoesntTriggerErrorCallback) {
StartWatching();
SignalTransientErrorForTest();
- StopWatching();
}
TEST_F(PolicyWatcherTest, MultipleTransientErrorsTriggerErrorCallback) {
@@ -493,7 +467,6 @@ TEST_F(PolicyWatcherTest, MultipleTransientErrorsTriggerErrorCallback) {
for (int i = 0; i < kMaxTransientErrorRetries; i++) {
SignalTransientErrorForTest();
}
- StopWatching();
}
TEST_F(PolicyWatcherTest, PolicyUpdateResetsTransientErrorsCounter) {
@@ -509,7 +482,6 @@ TEST_F(PolicyWatcherTest, PolicyUpdateResetsTransientErrorsCounter) {
for (int i = 0; i < (kMaxTransientErrorRetries - 1); i++) {
SignalTransientErrorForTest();
}
- StopWatching();
}
// Unit tests cannot instantiate PolicyWatcher on ChromeOS
@@ -564,16 +536,6 @@ TEST_F(PolicyWatcherTest, TestRealChromotingPolicy) {
run_loop.RunUntilIdle();
}
- {
- base::RunLoop run_loop;
- PolicyWatcher* raw_policy_watcher = policy_watcher.release();
- raw_policy_watcher->StopWatching(
- base::Bind(base::IgnoreResult(
- &base::SequencedTaskRunner::DeleteSoon<PolicyWatcher>),
- task_runner, FROM_HERE, raw_policy_watcher));
- run_loop.RunUntilIdle();
- }
-
// Today, the only verification offered by this test is:
// - Manual verification of policy values dumped by OnPolicyUpdatedDumpPolicy
// - Automated verification that nothing crashed

Powered by Google App Engine
This is Rietveld 408576698