Remove policy watching from It2MeHost.
This functionality is already present in It2MeNativeMessagingHost, which
owns the It2MeHost and can simply forward the policy changes to it.
This CL is part of a larger change to make the It2Me host react to
policy errors, at which point it will be more convenient to have a
single policy watcher.
BUG=433009
Review-Url: https://codereview.chromium.org/2847853003
Cr-Commit-Position: refs/heads/master@{#469834}
Committed: https://chromium.googlesource.com/chromium/src/+/cf2cc68d4e6a4a70bcadfd5491f90d119129ec38
3 years, 7 months ago
(2017-04-28 22:41:10 UTC)
#6
PTAL
https://codereview.chromium.org/2847853003/diff/40001/remoting/host/it2me/it2...
File remoting/host/it2me/it2me_host_unittest.cc (right):
https://codereview.chromium.org/2847853003/diff/40001/remoting/host/it2me/it2...
remoting/host/it2me/it2me_host_unittest.cc:222:
std::unique_ptr<base::DictionaryValue> dictionary(new base::DictionaryValue);
On 2017/04/28 21:15:36, rkjnsn wrote:
> nit: I think MakeUnique is more readable:
> auto dictionary = base::MakeUnique<base::DictionaryValue>();
Done.
https://codereview.chromium.org/2847853003/diff/40001/remoting/host/it2me/it2...
remoting/host/it2me/it2me_host_unittest.cc:226:
it2me_host_->OnPolicyUpdate(std::move(dictionary));
On 2017/04/28 21:15:36, rkjnsn wrote:
> Note that this will bypass normalization and deprecation logic in
PolicyWatcher,
> which means most of the tests will be broken after
> https://codereview.chromium.org/2682473003/ lands.
I'll hold off landing until that's in then. I think the right approach will be
just to simplify these tests not to expect that normalization, since it's
already tested in the policy watcher tests.
https://codereview.chromium.org/2847853003/diff/40001/remoting/host/it2me/it2...
remoting/host/it2me/it2me_host_unittest.cc:226:
it2me_host_->OnPolicyUpdate(std::move(dictionary));
On 2017/04/28 21:46:32, joedow wrote:
> On 2017/04/28 21:15:36, rkjnsn wrote:
> > Note that this will bypass normalization and deprecation logic in
> PolicyWatcher,
> > which means most of the tests will be broken after
> > https://codereview.chromium.org/2682473003/ lands.
>
> Using the old system (PolicyWatcher + FakeAsyncPolicyLoader) means you get our
> default values too so you dpon't have to init once with empty list in
> StartHost().
The tests hang without a call to SetPolicies (I think because the It2Me host
needs OnPolicyUpdate to be called before it does anything).
rkjnsn
https://codereview.chromium.org/2847853003/diff/40001/remoting/host/it2me/it2me_host_unittest.cc File remoting/host/it2me/it2me_host_unittest.cc (right): https://codereview.chromium.org/2847853003/diff/40001/remoting/host/it2me/it2me_host_unittest.cc#newcode226 remoting/host/it2me/it2me_host_unittest.cc:226: it2me_host_->OnPolicyUpdate(std::move(dictionary)); On 2017/04/28 22:41:09, Jamie wrote: > On 2017/04/28 ...
3 years, 7 months ago
(2017-05-02 19:19:12 UTC)
#7
https://codereview.chromium.org/2847853003/diff/40001/remoting/host/it2me/it2...
File remoting/host/it2me/it2me_host_unittest.cc (right):
https://codereview.chromium.org/2847853003/diff/40001/remoting/host/it2me/it2...
remoting/host/it2me/it2me_host_unittest.cc:226:
it2me_host_->OnPolicyUpdate(std::move(dictionary));
On 2017/04/28 22:41:09, Jamie wrote:
> On 2017/04/28 21:46:32, joedow wrote:
> > On 2017/04/28 21:15:36, rkjnsn wrote:
> > > Note that this will bypass normalization and deprecation logic in
> > PolicyWatcher,
> > > which means most of the tests will be broken after
> > > https://codereview.chromium.org/2682473003/ lands.
> >
> > Using the old system (PolicyWatcher + FakeAsyncPolicyLoader) means you get
our
> > default values too so you dpon't have to init once with empty list in
> > StartHost().
>
> The tests hang without a call to SetPolicies (I think because the It2Me host
> needs OnPolicyUpdate to be called before it does anything).
It2MeHost will indeed wait for OnPolicyUpdate to be called the first time. One
possibility would be to keep an actual instance of PolicyWatcher in It2MeTest.
That way, It2MeHost will get the default values as managed by PolicyWatcher
instead of an empty list for the initial call, and deprecation and normalization
will still happen (obviating the need to update the tests).
Jamie
https://codereview.chromium.org/2847853003/diff/40001/remoting/host/it2me/it2me_host_unittest.cc File remoting/host/it2me/it2me_host_unittest.cc (right): https://codereview.chromium.org/2847853003/diff/40001/remoting/host/it2me/it2me_host_unittest.cc#newcode226 remoting/host/it2me/it2me_host_unittest.cc:226: it2me_host_->OnPolicyUpdate(std::move(dictionary)); On 2017/05/02 19:19:12, rkjnsn wrote: > On 2017/04/28 ...
3 years, 7 months ago
(2017-05-02 22:07:57 UTC)
#8
https://codereview.chromium.org/2847853003/diff/40001/remoting/host/it2me/it2...
File remoting/host/it2me/it2me_host_unittest.cc (right):
https://codereview.chromium.org/2847853003/diff/40001/remoting/host/it2me/it2...
remoting/host/it2me/it2me_host_unittest.cc:226:
it2me_host_->OnPolicyUpdate(std::move(dictionary));
On 2017/05/02 19:19:12, rkjnsn wrote:
> On 2017/04/28 22:41:09, Jamie wrote:
> > On 2017/04/28 21:46:32, joedow wrote:
> > > On 2017/04/28 21:15:36, rkjnsn wrote:
> > > > Note that this will bypass normalization and deprecation logic in
> > > PolicyWatcher,
> > > > which means most of the tests will be broken after
> > > > https://codereview.chromium.org/2682473003/ lands.
> > >
> > > Using the old system (PolicyWatcher + FakeAsyncPolicyLoader) means you get
> our
> > > default values too so you dpon't have to init once with empty list in
> > > StartHost().
> >
> > The tests hang without a call to SetPolicies (I think because the It2Me host
> > needs OnPolicyUpdate to be called before it does anything).
>
> It2MeHost will indeed wait for OnPolicyUpdate to be called the first time. One
> possibility would be to keep an actual instance of PolicyWatcher in It2MeTest.
> That way, It2MeHost will get the default values as managed by PolicyWatcher
> instead of an empty list for the initial call, and deprecation and
normalization
> will still happen (obviating the need to update the tests).
I think that's mixing up responsibilities too much. This CL allows It2MeHost to
no longer care where its policies are coming from, so the test should provide
them in as simple a way as possible. Adding a PolicyWatcher to the test seems
overly complicated, and we shouldn't test normalization here, since it's not a
feature of It2MeHost.
rkjnsn
https://codereview.chromium.org/2847853003/diff/40001/remoting/host/it2me/it2me_host_unittest.cc File remoting/host/it2me/it2me_host_unittest.cc (right): https://codereview.chromium.org/2847853003/diff/40001/remoting/host/it2me/it2me_host_unittest.cc#newcode226 remoting/host/it2me/it2me_host_unittest.cc:226: it2me_host_->OnPolicyUpdate(std::move(dictionary)); On 2017/05/02 22:07:56, Jamie wrote: > On 2017/05/02 ...
3 years, 7 months ago
(2017-05-02 23:20:19 UTC)
#9
https://codereview.chromium.org/2847853003/diff/40001/remoting/host/it2me/it2...
File remoting/host/it2me/it2me_host_unittest.cc (right):
https://codereview.chromium.org/2847853003/diff/40001/remoting/host/it2me/it2...
remoting/host/it2me/it2me_host_unittest.cc:226:
it2me_host_->OnPolicyUpdate(std::move(dictionary));
On 2017/05/02 22:07:56, Jamie wrote:
> On 2017/05/02 19:19:12, rkjnsn wrote:
> > On 2017/04/28 22:41:09, Jamie wrote:
> > > On 2017/04/28 21:46:32, joedow wrote:
> > > > On 2017/04/28 21:15:36, rkjnsn wrote:
> > > > > Note that this will bypass normalization and deprecation logic in
> > > > PolicyWatcher,
> > > > > which means most of the tests will be broken after
> > > > > https://codereview.chromium.org/2682473003/ lands.
> > > >
> > > > Using the old system (PolicyWatcher + FakeAsyncPolicyLoader) means you
get
> > our
> > > > default values too so you dpon't have to init once with empty list in
> > > > StartHost().
> > >
> > > The tests hang without a call to SetPolicies (I think because the It2Me
host
> > > needs OnPolicyUpdate to be called before it does anything).
> >
> > It2MeHost will indeed wait for OnPolicyUpdate to be called the first time.
One
> > possibility would be to keep an actual instance of PolicyWatcher in
It2MeTest.
> > That way, It2MeHost will get the default values as managed by PolicyWatcher
> > instead of an empty list for the initial call, and deprecation and
> normalization
> > will still happen (obviating the need to update the tests).
>
> I think that's mixing up responsibilities too much. This CL allows It2MeHost
to
> no longer care where its policies are coming from, so the test should provide
> them in as simple a way as possible. Adding a PolicyWatcher to the test seems
> overly complicated, and we shouldn't test normalization here, since it's not a
> feature of It2MeHost.
I mostly agree. My main concern is here was the difference in behavior for the
initial call to OnPolicyUpdate. Here we initially call it with an empty
dictionary, whereas PolicyWatcher would call it with a dictionary that had all
of the policies set to there default values. This could potentially lead to
different behavior. E.g., with the approach here, the Update*Policy methods are
never called unless the corresponding policy is set by the test, whereas with
PolicyWatcher they are always called at least once. Also, the defaults might be
different (e.g., It2MeHost defaults nat_traversal_enabled_ to false, but
PolicyWatcher defaults the RemoteAccessHostFirewallTraversal policy to true).
Now, it's probably true that none of these matter, and if they ever do, the
SetPolicies({}) call below can be adjusted as needed. Thus, the current approach
should be fine. It may be worth putting a comment on the SetPolicies({}) call on
244 to call out the differing behavior, though.
rkjnsn
https://codereview.chromium.org/2847853003/diff/40001/remoting/host/it2me/it2me_host_unittest.cc File remoting/host/it2me/it2me_host_unittest.cc (right): https://codereview.chromium.org/2847853003/diff/40001/remoting/host/it2me/it2me_host_unittest.cc#newcode226 remoting/host/it2me/it2me_host_unittest.cc:226: it2me_host_->OnPolicyUpdate(std::move(dictionary)); On 2017/05/02 23:20:19, rkjnsn wrote: > I mostly ...
3 years, 7 months ago
(2017-05-02 23:27:19 UTC)
#10
https://codereview.chromium.org/2847853003/diff/40001/remoting/host/it2me/it2...
File remoting/host/it2me/it2me_host_unittest.cc (right):
https://codereview.chromium.org/2847853003/diff/40001/remoting/host/it2me/it2...
remoting/host/it2me/it2me_host_unittest.cc:226:
it2me_host_->OnPolicyUpdate(std::move(dictionary));
On 2017/05/02 23:20:19, rkjnsn wrote:
> I mostly agree. My main concern is here was the difference in behavior for the
> initial call to OnPolicyUpdate. Here we initially call it with an empty
> dictionary, whereas PolicyWatcher would call it with a dictionary that had all
> of the policies set to there default values. This could potentially lead to
> different behavior. E.g., with the approach here, the Update*Policy methods
are
> never called unless the corresponding policy is set by the test, whereas with
> PolicyWatcher they are always called at least once. Also, the defaults might
be
> different (e.g., It2MeHost defaults nat_traversal_enabled_ to false, but
> PolicyWatcher defaults the RemoteAccessHostFirewallTraversal policy to true).
>
> Now, it's probably true that none of these matter, and if they ever do, the
> SetPolicies({}) call below can be adjusted as needed. Thus, the current
approach
> should be fine. It may be worth putting a comment on the SetPolicies({}) call
on
> 244 to call out the differing behavior, though.
their*
Jamie
https://codereview.chromium.org/2847853003/diff/40001/remoting/host/it2me/it2me_host_unittest.cc File remoting/host/it2me/it2me_host_unittest.cc (right): https://codereview.chromium.org/2847853003/diff/40001/remoting/host/it2me/it2me_host_unittest.cc#newcode226 remoting/host/it2me/it2me_host_unittest.cc:226: it2me_host_->OnPolicyUpdate(std::move(dictionary)); On 2017/05/02 23:27:19, rkjnsn wrote: > On 2017/05/02 ...
3 years, 7 months ago
(2017-05-02 23:49:03 UTC)
#11
https://codereview.chromium.org/2847853003/diff/40001/remoting/host/it2me/it2...
File remoting/host/it2me/it2me_host_unittest.cc (right):
https://codereview.chromium.org/2847853003/diff/40001/remoting/host/it2me/it2...
remoting/host/it2me/it2me_host_unittest.cc:226:
it2me_host_->OnPolicyUpdate(std::move(dictionary));
On 2017/05/02 23:27:19, rkjnsn wrote:
> On 2017/05/02 23:20:19, rkjnsn wrote:
> > I mostly agree. My main concern is here was the difference in behavior for
the
> > initial call to OnPolicyUpdate. Here we initially call it with an empty
> > dictionary, whereas PolicyWatcher would call it with a dictionary that had
all
> > of the policies set to there default values. This could potentially lead to
> > different behavior. E.g., with the approach here, the Update*Policy methods
> are
> > never called unless the corresponding policy is set by the test, whereas
with
> > PolicyWatcher they are always called at least once. Also, the defaults might
> be
> > different (e.g., It2MeHost defaults nat_traversal_enabled_ to false, but
> > PolicyWatcher defaults the RemoteAccessHostFirewallTraversal policy to
true).
> >
> > Now, it's probably true that none of these matter, and if they ever do, the
> > SetPolicies({}) call below can be adjusted as needed. Thus, the current
> approach
> > should be fine. It may be worth putting a comment on the SetPolicies({})
call
> on
> > 244 to call out the differing behavior, though.
>
> their*
That's a good point. I was going to argue that It2MeHost should have suitable
defaults set for its member variables, but on reflection I don't think I believe
that, since those will be the same defaults as are set in the policy (or derived
from them) and duplication is never a good idea.
Perhaps the best solution is to instantiate a PolicyWatcher, but just use its
GetCurrentPolicies method to pre-set the defaults, and allow individual tests to
call SetPolicies to override anything they like. That still decouples It2MeHost
from the mechanics of PolicyWatcher, but does ensure that the correct default
values are set. WDYT?
Jamie
PTAL https://codereview.chromium.org/2847853003/diff/40001/remoting/host/it2me/it2me_host_unittest.cc File remoting/host/it2me/it2me_host_unittest.cc (right): https://codereview.chromium.org/2847853003/diff/40001/remoting/host/it2me/it2me_host_unittest.cc#newcode226 remoting/host/it2me/it2me_host_unittest.cc:226: it2me_host_->OnPolicyUpdate(std::move(dictionary)); On 2017/05/02 23:49:03, Jamie wrote: > On ...
3 years, 7 months ago
(2017-05-03 20:41:04 UTC)
#12
PTAL
https://codereview.chromium.org/2847853003/diff/40001/remoting/host/it2me/it2...
File remoting/host/it2me/it2me_host_unittest.cc (right):
https://codereview.chromium.org/2847853003/diff/40001/remoting/host/it2me/it2...
remoting/host/it2me/it2me_host_unittest.cc:226:
it2me_host_->OnPolicyUpdate(std::move(dictionary));
On 2017/05/02 23:49:03, Jamie wrote:
> On 2017/05/02 23:27:19, rkjnsn wrote:
> > On 2017/05/02 23:20:19, rkjnsn wrote:
> > > I mostly agree. My main concern is here was the difference in behavior for
> the
> > > initial call to OnPolicyUpdate. Here we initially call it with an empty
> > > dictionary, whereas PolicyWatcher would call it with a dictionary that had
> all
> > > of the policies set to there default values. This could potentially lead
to
> > > different behavior. E.g., with the approach here, the Update*Policy
methods
> > are
> > > never called unless the corresponding policy is set by the test, whereas
> with
> > > PolicyWatcher they are always called at least once. Also, the defaults
might
> > be
> > > different (e.g., It2MeHost defaults nat_traversal_enabled_ to false, but
> > > PolicyWatcher defaults the RemoteAccessHostFirewallTraversal policy to
> true).
> > >
> > > Now, it's probably true that none of these matter, and if they ever do,
the
> > > SetPolicies({}) call below can be adjusted as needed. Thus, the current
> > approach
> > > should be fine. It may be worth putting a comment on the SetPolicies({})
> call
> > on
> > > 244 to call out the differing behavior, though.
> >
> > their*
>
> That's a good point. I was going to argue that It2MeHost should have suitable
> defaults set for its member variables, but on reflection I don't think I
believe
> that, since those will be the same defaults as are set in the policy (or
derived
> from them) and duplication is never a good idea.
>
> Perhaps the best solution is to instantiate a PolicyWatcher, but just use its
> GetCurrentPolicies method to pre-set the defaults, and allow individual tests
to
> call SetPolicies to override anything they like. That still decouples
It2MeHost
> from the mechanics of PolicyWatcher, but does ensure that the correct default
> values are set. WDYT?
I've taken this approach in the most recent iteration.
rkjnsn
https://codereview.chromium.org/2847853003/diff/140001/remoting/host/it2me/it2me_native_messaging_host.cc File remoting/host/it2me/it2me_native_messaging_host.cc (right): https://codereview.chromium.org/2847853003/diff/140001/remoting/host/it2me/it2me_native_messaging_host.cc#newcode474 remoting/host/it2me/it2me_native_messaging_host.cc:474: // way to communicate changes to the user. Out ...
3 years, 7 months ago
(2017-05-03 21:31:48 UTC)
#13
PTAL https://codereview.chromium.org/2847853003/diff/140001/remoting/host/it2me/it2me_native_messaging_host.cc File remoting/host/it2me/it2me_native_messaging_host.cc (right): https://codereview.chromium.org/2847853003/diff/140001/remoting/host/it2me/it2me_native_messaging_host.cc#newcode474 remoting/host/it2me/it2me_native_messaging_host.cc:474: // way to communicate changes to the user. ...
3 years, 7 months ago
(2017-05-03 23:41:10 UTC)
#14
https://codereview.chromium.org/2847853003/diff/140001/remoting/host/it2me/it2me_native_messaging_host.cc File remoting/host/it2me/it2me_native_messaging_host.cc (right): https://codereview.chromium.org/2847853003/diff/140001/remoting/host/it2me/it2me_native_messaging_host.cc#newcode474 remoting/host/it2me/it2me_native_messaging_host.cc:474: // way to communicate changes to the user. On ...
3 years, 7 months ago
(2017-05-04 17:24:22 UTC)
#15
https://codereview.chromium.org/2847853003/diff/140001/remoting/host/it2me/it...
File remoting/host/it2me/it2me_native_messaging_host.cc (right):
https://codereview.chromium.org/2847853003/diff/140001/remoting/host/it2me/it...
remoting/host/it2me/it2me_native_messaging_host.cc:474: // way to communicate
changes to the user.
On 2017/05/03 23:41:10, Jamie wrote:
> On 2017/05/03 21:31:47, rkjnsn wrote:
> > Out of curiosity, in most places we try to enforce policy changes
immediately,
> > even if it requires disconnecting the sessions and restarting the host. What
> > makes this one different?
>
> I'm not sure (Joe might be able to shed some light on it). I can always fix
that
> up as part of the CL that implements policy error handling.
Not all policy changes force a restart (for instance the Me2Me host will restart
for auth related policies but not others (OnUsernamePolicyUpdate for example)).
IIRC my thought was that this was something that would get enabled so the likely
transition would be from non-UiAccess to UiAccess. Going the other way would
mean the remote user has UiAccess for the rest of the session, but that isn't a
big concern (in the future I would like to enable this regardless of policy).
rkjnsn
https://codereview.chromium.org/2847853003/diff/140001/remoting/host/it2me/it2me_native_messaging_host.cc File remoting/host/it2me/it2me_native_messaging_host.cc (right): https://codereview.chromium.org/2847853003/diff/140001/remoting/host/it2me/it2me_native_messaging_host.cc#newcode474 remoting/host/it2me/it2me_native_messaging_host.cc:474: // way to communicate changes to the user. On ...
3 years, 7 months ago
(2017-05-04 20:45:46 UTC)
#16
https://codereview.chromium.org/2847853003/diff/140001/remoting/host/it2me/it...
File remoting/host/it2me/it2me_native_messaging_host.cc (right):
https://codereview.chromium.org/2847853003/diff/140001/remoting/host/it2me/it...
remoting/host/it2me/it2me_native_messaging_host.cc:474: // way to communicate
changes to the user.
On 2017/05/04 17:24:22, joedow wrote:
> On 2017/05/03 23:41:10, Jamie wrote:
> > On 2017/05/03 21:31:47, rkjnsn wrote:
> > > Out of curiosity, in most places we try to enforce policy changes
> immediately,
> > > even if it requires disconnecting the sessions and restarting the host.
What
> > > makes this one different?
> >
> > I'm not sure (Joe might be able to shed some light on it). I can always fix
> that
> > up as part of the CL that implements policy error handling.
>
> Not all policy changes force a restart (for instance the Me2Me host will
restart
> for auth related policies but not others (OnUsernamePolicyUpdate for
example)).
>
> IIRC my thought was that this was something that would get enabled so the
likely
> transition would be from non-UiAccess to UiAccess. Going the other way would
> mean the remote user has UiAccess for the rest of the session, but that isn't
a
> big concern (in the future I would like to enable this regardless of policy).
>
Isn't the native messaging host potentially long-running, though? That is, won't
the old policy potentially be used for multiple it2me sessions after having been
changed?
Either way, I'm not concerned about it for this CL, since the behavior is
unchanged.
https://codereview.chromium.org/2847853003/diff/140001/remoting/host/it2me/it...
File remoting/host/it2me/it2me_native_messaging_host_unittest.cc (right):
https://codereview.chromium.org/2847853003/diff/140001/remoting/host/it2me/it...
remoting/host/it2me/it2me_native_messaging_host_unittest.cc:399: bool
nat_policy_received = false;
On 2017/05/03 23:41:10, Jamie wrote:
> On 2017/05/03 21:31:47, rkjnsn wrote:
> > I see this was added to fix the unit test, but I can't figure out it falls
out
> > from the other changes.
>
> The change to the native messaging host means that It2MeHost::OnPolicyUpdate
is
> now being called whereas previously it wasn't, which results in additional
> message being sent. Does that answer your question?
Ah, I see. Since MockIt2MeHost overrides Connect, which before this change would
have normally kicked off reading the policy, the policy was never read and
OnNatPolicyChanged was never getting called. Now that the code is calling
OnPolicyUpdate explicitly, which isn't overridden by the mock,
OnNatPolicyChanged is getting called as a result.
https://codereview.chromium.org/2847853003/diff/160001/remoting/host/it2me/it...
File remoting/host/it2me/it2me_native_messaging_host.cc (right):
https://codereview.chromium.org/2847853003/diff/160001/remoting/host/it2me/it...
remoting/host/it2me/it2me_native_messaging_host.cc:323:
it2me_host_->OnPolicyUpdate(policy_watcher_->GetCurrentPolicies());
Looking at the code, I realized that It2MeNativeMessagingHost creates a
PolicyWatcher using the standard Create method, even when running tests. That
means that with this change, it2me_host will be passed the real policies from
the local machine when running the It2MeNativeMessagingHost tests. I don't
*think* that can cause a test failure, since we override Connect and Disconnect
for testing, but it might make it easier for a future change to introduce test
dependence on the host system.
Jamie
https://codereview.chromium.org/2847853003/diff/160001/remoting/host/it2me/it2me_native_messaging_host.cc File remoting/host/it2me/it2me_native_messaging_host.cc (right): https://codereview.chromium.org/2847853003/diff/160001/remoting/host/it2me/it2me_native_messaging_host.cc#newcode323 remoting/host/it2me/it2me_native_messaging_host.cc:323: it2me_host_->OnPolicyUpdate(policy_watcher_->GetCurrentPolicies()); On 2017/05/04 20:45:45, rkjnsn wrote: > Looking at ...
3 years, 7 months ago
(2017-05-04 22:11:51 UTC)
#17
https://codereview.chromium.org/2847853003/diff/160001/remoting/host/it2me/it...
File remoting/host/it2me/it2me_native_messaging_host.cc (right):
https://codereview.chromium.org/2847853003/diff/160001/remoting/host/it2me/it...
remoting/host/it2me/it2me_native_messaging_host.cc:323:
it2me_host_->OnPolicyUpdate(policy_watcher_->GetCurrentPolicies());
On 2017/05/04 20:45:45, rkjnsn wrote:
> Looking at the code, I realized that It2MeNativeMessagingHost creates a
> PolicyWatcher using the standard Create method, even when running tests. That
> means that with this change, it2me_host will be passed the real policies from
> the local machine when running the It2MeNativeMessagingHost tests. I don't
> *think* that can cause a test failure, since we override Connect and
Disconnect
> for testing, but it might make it easier for a future change to introduce test
> dependence on the host system.
Given that It2MeNativeMessagingHost is currently constructed from a
PolicyService instance, which is only used to construct the PolicyWatcher, I
think it might as well just be constructed with a PolicyWatcher directly, which
would allow tests to control it. I think that belongs in this CL.
Jamie
PTAL
3 years, 7 months ago
(2017-05-04 22:27:11 UTC)
#18
PTAL
rkjnsn
Mostly looks good, with one comment. https://codereview.chromium.org/2847853003/diff/180001/remoting/host/it2me/it2me_native_messaging_host_unittest.cc File remoting/host/it2me/it2me_native_messaging_host_unittest.cc (right): https://codereview.chromium.org/2847853003/diff/180001/remoting/host/it2me/it2me_native_messaging_host_unittest.cc#newcode536 remoting/host/it2me/it2me_native_messaging_host_unittest.cc:536: fake_policy_service_.get(), context->file_task_runner()); This ...
3 years, 7 months ago
(2017-05-04 22:52:40 UTC)
#19
3 years, 7 months ago
(2017-05-04 23:08:40 UTC)
#20
PTAL
https://codereview.chromium.org/2847853003/diff/180001/remoting/host/it2me/it...
File remoting/host/it2me/it2me_native_messaging_host_unittest.cc (right):
https://codereview.chromium.org/2847853003/diff/180001/remoting/host/it2me/it...
remoting/host/it2me/it2me_native_messaging_host_unittest.cc:536:
fake_policy_service_.get(), context->file_task_runner());
On 2017/05/04 22:52:40, rkjnsn wrote:
> This will still create a PolicyWatcher that reads the real policy from the
> current system. To isolate the tests, you'll need to use
> PolicyWatcher::CreateFromPolicyLoaderForTesting along with
> policy::FakeAsyncPolicyLoader.
Done (it let me delete FakePolicyService entirely, which was a nice bonus).
rkjnsn
lgtm
3 years, 7 months ago
(2017-05-04 23:28:47 UTC)
#21
lgtm
Jamie
Joe, can I get an LGTM for committers?
3 years, 7 months ago
(2017-05-05 00:35:29 UTC)
#22
Joe, can I get an LGTM for committers?
joedow
lgtm https://codereview.chromium.org/2847853003/diff/200001/remoting/host/it2me/it2me_host.h File remoting/host/it2me/it2me_host.h (right): https://codereview.chromium.org/2847853003/diff/200001/remoting/host/it2me/it2me_host.h#newcode96 remoting/host/it2me/it2me_host.h:96: // Called when initial policies are read, and ...
3 years, 7 months ago
(2017-05-05 14:42:15 UTC)
#23
FYI https://codereview.chromium.org/2847853003/diff/200001/remoting/host/it2me/it2me_host.h File remoting/host/it2me/it2me_host.h (right): https://codereview.chromium.org/2847853003/diff/200001/remoting/host/it2me/it2me_host.h#newcode96 remoting/host/it2me/it2me_host.h:96: // Called when initial policies are read, and ...
3 years, 7 months ago
(2017-05-05 16:49:06 UTC)
#24
https://codereview.chromium.org/2847853003/diff/200001/remoting/host/policy_watcher.cc File remoting/host/policy_watcher.cc (right): https://codereview.chromium.org/2847853003/diff/200001/remoting/host/policy_watcher.cc#newcode162 remoting/host/policy_watcher.cc:162: // If old_policies is empty, then the PolicyService has ...
3 years, 7 months ago
(2017-05-05 16:53:04 UTC)
#28
https://codereview.chromium.org/2847853003/diff/200001/remoting/host/policy_watcher.cc File remoting/host/policy_watcher.cc (right): https://codereview.chromium.org/2847853003/diff/200001/remoting/host/policy_watcher.cc#newcode162 remoting/host/policy_watcher.cc:162: // If old_policies is empty, then the PolicyService has ...
3 years, 7 months ago
(2017-05-05 16:57:58 UTC)
#32
Try jobs failed on following builders: chromeos_amd64-generic_chromium_compile_only_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromeos_amd64-generic_chromium_compile_only_ng/builds/333149)
3 years, 7 months ago
(2017-05-05 17:11:44 UTC)
#35
Description was changed from ========== Remove policy watching from It2MeHost. This functionality is already present ...
3 years, 7 months ago
(2017-05-05 18:22:56 UTC)
#36
Description was changed from
==========
Remove policy watching from It2MeHost.
This functionality is already present in It2MeNativeMessagingHost, which
owns the It2MeHost and can simply forward the policy changes to it.
This CL is part of a larger change to make the It2Me host react to
policy errors, at which point it will be more convenient to have a
single policy watcher.
BUG=433009
==========
to
==========
Remove policy watching from It2MeHost.
This functionality is already present in It2MeNativeMessagingHost, which
owns the It2MeHost and can simply forward the policy changes to it.
This CL is part of a larger change to make the It2Me host react to
policy errors, at which point it will be more convenient to have a
single policy watcher.
BUG=433009
==========
Try jobs failed on following builders: chromeos_amd64-generic_chromium_compile_only_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromeos_amd64-generic_chromium_compile_only_ng/builds/333372) linux_chromium_chromeos_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, ...
3 years, 7 months ago
(2017-05-05 20:56:55 UTC)
#45
CQ is committing da patch. Bot data: {"patchset_id": 300001, "attempt_start_ts": 1494019519515050, "parent_rev": "02ea6568c0b73b6c9873ea2f3aef44d77dc81a25", "commit_rev": "cf2cc68d4e6a4a70bcadfd5491f90d119129ec38"}
3 years, 7 months ago
(2017-05-06 00:51:55 UTC)
#49
CQ is committing da patch.
Bot data: {"patchset_id": 300001, "attempt_start_ts": 1494019519515050,
"parent_rev": "02ea6568c0b73b6c9873ea2f3aef44d77dc81a25", "commit_rev":
"cf2cc68d4e6a4a70bcadfd5491f90d119129ec38"}
commit-bot: I haz the power
CQ is committing da patch. Bot data: {"patchset_id": 300001, "attempt_start_ts": 1494019519515050, "parent_rev": "02ea6568c0b73b6c9873ea2f3aef44d77dc81a25", "commit_rev": "cf2cc68d4e6a4a70bcadfd5491f90d119129ec38"}
3 years, 7 months ago
(2017-05-06 00:52:51 UTC)
#50
CQ is committing da patch.
Bot data: {"patchset_id": 300001, "attempt_start_ts": 1494019519515050,
"parent_rev": "02ea6568c0b73b6c9873ea2f3aef44d77dc81a25", "commit_rev":
"cf2cc68d4e6a4a70bcadfd5491f90d119129ec38"}
commit-bot: I haz the power
Description was changed from ========== Remove policy watching from It2MeHost. This functionality is already present ...
3 years, 7 months ago
(2017-05-06 00:52:53 UTC)
#51
Message was sent while issue was closed.
Description was changed from
==========
Remove policy watching from It2MeHost.
This functionality is already present in It2MeNativeMessagingHost, which
owns the It2MeHost and can simply forward the policy changes to it.
This CL is part of a larger change to make the It2Me host react to
policy errors, at which point it will be more convenient to have a
single policy watcher.
BUG=433009
==========
to
==========
Remove policy watching from It2MeHost.
This functionality is already present in It2MeNativeMessagingHost, which
owns the It2MeHost and can simply forward the policy changes to it.
This CL is part of a larger change to make the It2Me host react to
policy errors, at which point it will be more convenient to have a
single policy watcher.
BUG=433009
Review-Url: https://codereview.chromium.org/2847853003
Cr-Commit-Position: refs/heads/master@{#469834}
Committed:
https://chromium.googlesource.com/chromium/src/+/cf2cc68d4e6a4a70bcadfd5491f9...
==========
commit-bot: I haz the power
Committed patchset #16 (id:300001) as https://chromium.googlesource.com/chromium/src/+/cf2cc68d4e6a4a70bcadfd5491f90d119129ec38
3 years, 7 months ago
(2017-05-06 00:52:55 UTC)
#52
Issue 2847853003: Remove policy watching from It2MeHost.
(Closed)
Created 3 years, 7 months ago by Jamie
Modified 3 years, 7 months ago
Reviewers: joedow, rkjnsn, Devlin
Base URL:
Comments: 40