PM: Add a DBus backend to the shill provider.
This change integrates the necessary logic for the shill provider to
actually talk to shill over DBus.
* RealShillProviders now takes a DbusInterface object. PolicyManager and
RealState were extended to propagate this object, accordingly.
* New provider_utils and general glib_utils modules.
* Minor touch-ups: removal of redundant includes and unwarranted 'using'
clauses.
BUG=chromium:338585
TEST=Unit tests.
Change-Id: I4082b845557eff2a02a928c60c348dde0e784a2c
Reviewed-on: https://chromium-review.googlesource.com/189045
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
diff --git a/policy_manager/policy_manager_unittest.cc b/policy_manager/policy_manager_unittest.cc
index 9e28ebc..fd43045 100644
--- a/policy_manager/policy_manager_unittest.cc
+++ b/policy_manager/policy_manager_unittest.cc
@@ -8,10 +8,11 @@
#include <base/bind.h>
#include <base/memory/scoped_ptr.h>
-#include <base/time.h>
#include <gtest/gtest.h>
#include <gmock/gmock.h>
+#include "update_engine/fake_clock.h"
+#include "update_engine/mock_dbus_wrapper.h"
#include "update_engine/policy_manager/default_policy.h"
#include "update_engine/policy_manager/mock_policy.h"
#include "update_engine/policy_manager/pmtest_utils.h"
@@ -20,24 +21,34 @@
using base::Bind;
using base::Callback;
-using base::TimeDelta;
+using chromeos_update_engine::FakeClock;
+using chromeos_update_engine::MockDBusWrapper;
using std::pair;
using std::string;
using std::vector;
-
-using testing::_;
+using testing::NiceMock;
using testing::Return;
using testing::StrictMock;
+using testing::_;
+
+namespace {
+
+DBusGConnection* const kFakeConnection = reinterpret_cast<DBusGConnection*>(1);
+
+} // namespace
namespace chromeos_policy_manager {
class PmPolicyManagerTest : public ::testing::Test {
protected:
virtual void SetUp() {
- EXPECT_TRUE(pmut_.Init());
+ EXPECT_CALL(mock_dbus_, BusGet(_, _)).WillOnce(Return(kFakeConnection));
+ EXPECT_TRUE(pmut_.Init(&mock_dbus_, &fake_clock_));
}
- PolicyManager pmut_; // PolicyManager undert test.
+ NiceMock<MockDBusWrapper> mock_dbus_;
+ FakeClock fake_clock_;
+ PolicyManager pmut_;
};
// The FailingPolicy implements a single method and make it always fail. This