| Index: remoting/host/policy_watcher_unittest.cc
|
| diff --git a/remoting/host/policy_watcher_unittest.cc b/remoting/host/policy_watcher_unittest.cc
|
| index 9ef5cc9349941be0a854e40ed8d87beea2b5fc05..e6b3d85121361a52572aef6406da9b89c3cc05ae 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::kRemoteAssistanceHostAllowUiAccess, true);
|
| + remote_assistance_uiaccess_false_.SetBoolean(
|
| + key::kRemoteAssistanceHostAllowUiAccess, 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,7 @@ class PolicyWatcherTest : public testing::Test {
|
| dict.SetString(key::kRemoteAccessHostTokenValidationCertificateIssuer, "");
|
| dict.SetBoolean(key::kRemoteAccessHostAllowClientPairing, true);
|
| dict.SetBoolean(key::kRemoteAccessHostAllowGnubbyAuth, true);
|
| + dict.SetBoolean(key::kRemoteAssistanceHostAllowUiAccess, false);
|
|
|
| ASSERT_THAT(&dict, IsPolicies(&GetDefaultValues()))
|
| << "Sanity check that defaults expected by the test code "
|
| @@ -491,6 +498,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 +643,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::kRemoteAssistanceHostAllowUiAccess);
|
| #endif
|
|
|
| std::map<std::string, base::Value::Type> actual_schema;
|
| @@ -623,7 +653,8 @@ TEST_F(PolicyWatcherTest, PolicySchemaAndPolicyWatcherShouldBeInSync) {
|
| ASSERT_TRUE(schema->valid());
|
| for (auto it = schema->GetPropertiesIterator(); !it.IsAtEnd(); it.Advance()) {
|
| std::string key = it.key();
|
| - if (key.find("RemoteAccessHost") == std::string::npos) {
|
| + if (key.find("RemoteAccessHost") == std::string::npos &&
|
| + key.find("RemoteAssistanceHost") == std::string::npos) {
|
| // For now PolicyWatcher::GetPolicySchema() mixes Chrome and Chromoting
|
| // policies, so we have to skip them here.
|
| continue;
|
|
|