Also use DevicePolicy::GetAuP2PEnabled() to determine if p2p is enabled
With this change update_engine will use p2p either if the user has
manually enabled it (through the crosh flag) OR if the enterprise has
enabled it in Enterprise Policy.
BUG=chromium:260442
TEST=New unit tests + unit tests pass.
Change-Id: I54cd92c481bd2fd7c90232d7137ce2b37fa2ce61
Reviewed-on: https://chromium-review.googlesource.com/168950
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
diff --git a/mock_p2p_manager.h b/mock_p2p_manager.h
index ff633f8..4d91765 100644
--- a/mock_p2p_manager.h
+++ b/mock_p2p_manager.h
@@ -16,6 +16,9 @@
public:
MockP2PManager() {
// Delegate all calls to the fake instance
+ ON_CALL(*this, SetDevicePolicy(testing::_))
+ .WillByDefault(testing::Invoke(&fake_,
+ &FakeP2PManager::SetDevicePolicy));
ON_CALL(*this, IsP2PEnabled())
.WillByDefault(testing::Invoke(&fake_,
&FakeP2PManager::IsP2PEnabled));
@@ -58,6 +61,7 @@
virtual ~MockP2PManager() {}
// P2PManager overrides.
+ MOCK_METHOD1(SetDevicePolicy, void(const policy::DevicePolicy*));
MOCK_METHOD0(IsP2PEnabled, bool());
MOCK_METHOD0(EnsureP2PRunning, bool());
MOCK_METHOD0(EnsureP2PNotRunning, bool());