Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef SHILL_PROPERTY_STORE_UNITTEST_H_ |
| 6 | #define SHILL_PROPERTY_STORE_UNITTEST_H_ |
| 7 | |
| 8 | #include <map> |
| 9 | #include <string> |
| 10 | #include <vector> |
| 11 | |
| 12 | #include <dbus-c++/dbus.h> |
| 13 | #include <gtest/gtest.h> |
| 14 | #include <gmock/gmock.h> |
| 15 | |
| 16 | #include "shill/dbus_adaptor.h" |
| 17 | #include "shill/error.h" |
| 18 | #include "shill/manager.h" |
| 19 | #include "shill/mock_control.h" |
Chris Masone | 7aa5f90 | 2011-07-11 11:13:35 -0700 | [diff] [blame] | 20 | #include "shill/mock_glib.h" |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 21 | #include "shill/property_store.h" |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 22 | #include "shill/shill_event.h" |
| 23 | |
| 24 | namespace shill { |
| 25 | |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 26 | class PropertyStoreTest : public testing::TestWithParam< ::DBus::Variant > { |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 27 | public: |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 28 | // In real code, it's frowned upon to have non-POD static members, as there |
| 29 | // can be ordering issues if your constructors have side effects. |
| 30 | // These constructors don't, and declaring these as static lets me |
| 31 | // autogenerate a bunch of unit test code that I would otherwise need to |
| 32 | // copypasta. So I think it's safe and worth it. |
| 33 | static const ::DBus::Variant kBoolV; |
| 34 | static const ::DBus::Variant kByteV; |
| 35 | static const ::DBus::Variant kInt16V; |
| 36 | static const ::DBus::Variant kInt32V; |
| 37 | static const ::DBus::Variant kStringV; |
| 38 | static const ::DBus::Variant kStringmapV; |
| 39 | static const ::DBus::Variant kStringmapsV; |
| 40 | static const ::DBus::Variant kStringsV; |
Chris Masone | 889666b | 2011-07-03 12:58:50 -0700 | [diff] [blame] | 41 | static const ::DBus::Variant kStrIntPairV; |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 42 | static const ::DBus::Variant kUint16V; |
| 43 | static const ::DBus::Variant kUint32V; |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 44 | |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 45 | PropertyStoreTest(); |
| 46 | virtual ~PropertyStoreTest(); |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 47 | |
| 48 | protected: |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 49 | MockControl control_interface_; |
| 50 | EventDispatcher dispatcher_; |
| 51 | Manager manager_; |
Chris Masone | 7aa5f90 | 2011-07-11 11:13:35 -0700 | [diff] [blame] | 52 | MockGLib glib_; |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 53 | std::string invalid_args_; |
| 54 | std::string invalid_prop_; |
| 55 | }; |
| 56 | |
| 57 | } // namespace shill |
| 58 | #endif // SHILL_PROPERTY_STORE_UNITTEST_H_ |