Index: remoting/host/policy_watcher_unittest.cc |
diff --git a/remoting/host/policy_watcher_unittest.cc b/remoting/host/policy_watcher_unittest.cc |
index bec13478216d36a0ac0370a0a267e571e4eeb5d6..1147988bf3f5e168d619d0dda73f9f30a332dd42 100644 |
--- a/remoting/host/policy_watcher_unittest.cc |
+++ b/remoting/host/policy_watcher_unittest.cc |
@@ -148,6 +148,10 @@ class PolicyWatcherTest : public testing::Test { |
third_party_auth_cert_empty_.MergeDictionary(&third_party_auth_partial_); |
third_party_auth_cert_empty_.SetString( |
key::kRemoteAccessHostTokenValidationCertificateIssuer, ""); |
+ remote_assistance_uiaccess_true_.SetBoolean( |
+ key::kRemoteAccessHostAllowUiAccessForRemoteAssistance, true); |
+ remote_assistance_uiaccess_false_.SetBoolean( |
+ key::kRemoteAccessHostAllowUiAccessForRemoteAssistance, false); |
} |
void TearDown() override { |
@@ -238,6 +242,8 @@ class PolicyWatcherTest : public testing::Test { |
base::DictionaryValue third_party_auth_full_; |
base::DictionaryValue third_party_auth_partial_; |
base::DictionaryValue third_party_auth_cert_empty_; |
+ base::DictionaryValue remote_assistance_uiaccess_true_; |
+ base::DictionaryValue remote_assistance_uiaccess_false_; |
private: |
void SetDefaults(base::DictionaryValue& dict) { |
@@ -255,6 +261,8 @@ class PolicyWatcherTest : public testing::Test { |
dict.SetString(key::kRemoteAccessHostTokenValidationCertificateIssuer, ""); |
dict.SetBoolean(key::kRemoteAccessHostAllowClientPairing, true); |
dict.SetBoolean(key::kRemoteAccessHostAllowGnubbyAuth, true); |
+ dict.SetBoolean(key::kRemoteAccessHostAllowUiAccessForRemoteAssistance, |
+ false); |
ASSERT_THAT(&dict, IsPolicies(&GetDefaultValues())) |
<< "Sanity check that defaults expected by the test code " |
@@ -491,6 +499,26 @@ TEST_F(PolicyWatcherTest, GnubbyAuth) { |
SetPolicies(gnubby_auth_true_); |
} |
+TEST_F(PolicyWatcherTest, RemoteAssistanceUiAccess) { |
+ testing::InSequence sequence; |
+ EXPECT_CALL(mock_policy_callback_, |
+ OnPolicyUpdatePtr(IsPolicies(&nat_true_others_default_))); |
+#if defined(OS_WIN) |
+ // This setting only affects Windows, it is ignored on other platforms so the |
+ // 2 SetPolicies calls won't result in any calls to OnPolicyUpdate. |
+ EXPECT_CALL(mock_policy_callback_, |
+ OnPolicyUpdatePtr(IsPolicies(&remote_assistance_uiaccess_true_))); |
+ EXPECT_CALL( |
+ mock_policy_callback_, |
+ OnPolicyUpdatePtr(IsPolicies(&remote_assistance_uiaccess_false_))); |
+#endif // defined(OS_WIN) |
+ |
+ SetPolicies(empty_); |
+ StartWatching(); |
+ SetPolicies(remote_assistance_uiaccess_true_); |
+ SetPolicies(remote_assistance_uiaccess_false_); |
+} |
+ |
TEST_F(PolicyWatcherTest, Relay) { |
testing::InSequence sequence; |
EXPECT_CALL(mock_policy_callback_, |
@@ -616,6 +644,9 @@ TEST_F(PolicyWatcherTest, PolicySchemaAndPolicyWatcherShouldBeInSync) { |
// RemoteAccessHostMatchUsername is marked in policy_templates.json as not |
// supported on Windows and therefore is (by design) excluded from the schema. |
expected_schema.erase(key::kRemoteAccessHostMatchUsername); |
+#else // !defined(OS_WIN) |
+ // RemoteAssistanceHostAllowUiAccess does not exist on non-Windows platforms. |
+ expected_schema.erase(key::kRemoteAccessHostAllowUiAccessForRemoteAssistance); |
#endif |
std::map<std::string, base::Value::Type> actual_schema; |