diff options
author | Gilad Arnold <garnold@chromium.org> | 2014-10-28 15:57:30 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-11-12 02:42:43 +0000 |
commit | 4a0321b804524e001b482edea882bd1fc4af98a2 (patch) | |
tree | 896826dca671af3a0cd712ef7aa408349daea04e /download_action_unittest.cc | |
parent | 020600db42428e7e96bb0d2e05da225e68650955 (diff) |
update_engine: Policy determines P2P enabled status.
This switches the P2P Manager to use the newly introduced Update Manger
policy requests in determining whether P2P is enabled on the system.
There is a policy request for the initial state (P2PEnabled, sync) and
for tracking changes (P2PEnabledChanged, async), with the latest known
value being cached by the P2P Manager.
This also reverses a recent change that moved P2P prefs setting into the
P2PManager. In the absence of any additional logic (now cleared) there
was no point in having a dedicated method just for that, and so
dbus_service writes the prefs value directly. This affords us removing
the prefs argument when initializing the P2PManager.
BUG=chromium:425233
TEST=Unit tests.
Change-Id: I53280f05da8fe532b6502c175a8cc9ddc1e15a87
Reviewed-on: https://chromium-review.googlesource.com/226937
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Diffstat (limited to 'download_action_unittest.cc')
-rw-r--r-- | download_action_unittest.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/download_action_unittest.cc b/download_action_unittest.cc index 78e3f5cb..d27f9636 100644 --- a/download_action_unittest.cc +++ b/download_action_unittest.cc @@ -24,6 +24,7 @@ #include "update_engine/mock_prefs.h" #include "update_engine/omaha_hash_calculator.h" #include "update_engine/test_utils.h" +#include "update_engine/update_manager/fake_update_manager.h" #include "update_engine/utils.h" namespace chromeos_update_engine { @@ -444,7 +445,8 @@ class P2PDownloadActionTest : public testing::Test { protected: P2PDownloadActionTest() : loop_(nullptr), - start_at_offset_(0) {} + start_at_offset_(0), + fake_um_(fake_system_state_.fake_clock()) {} virtual ~P2PDownloadActionTest() {} @@ -471,7 +473,7 @@ class P2PDownloadActionTest : public testing::Test { // Setup p2p. FakeP2PManagerConfiguration *test_conf = new FakeP2PManagerConfiguration(); p2p_manager_.reset(P2PManager::Construct( - test_conf, nullptr, nullptr, "cros_au", 3, + test_conf, nullptr, &fake_um_, "cros_au", 3, base::TimeDelta::FromDays(5))); fake_system_state_.set_p2p_manager(p2p_manager_.get()); } @@ -553,6 +555,8 @@ class P2PDownloadActionTest : public testing::Test { // The requested starting offset passed to SetupDownload(). off_t start_at_offset_; + + chromeos_update_manager::FakeUpdateManager fake_um_; }; TEST_F(P2PDownloadActionTest, IsWrittenTo) { |