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 | |
Chris Masone | 2ae797d | 2011-08-23 20:41:00 -0700 | [diff] [blame^] | 12 | #include <base/memory/scoped_temp_dir.h> |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 13 | #include <dbus-c++/dbus.h> |
Chris Masone | 7156c92 | 2011-08-23 20:36:21 -0700 | [diff] [blame] | 14 | #include <gmock/gmock.h> |
Chris Masone | 2ae797d | 2011-08-23 20:41:00 -0700 | [diff] [blame^] | 15 | #include <gtest/gtest.h> |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 16 | |
| 17 | #include "shill/dbus_adaptor.h" |
| 18 | #include "shill/error.h" |
| 19 | #include "shill/manager.h" |
| 20 | #include "shill/mock_control.h" |
Chris Masone | 7aa5f90 | 2011-07-11 11:13:35 -0700 | [diff] [blame] | 21 | #include "shill/mock_glib.h" |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 22 | #include "shill/property_store.h" |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 23 | #include "shill/shill_event.h" |
| 24 | |
| 25 | namespace shill { |
| 26 | |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 27 | class PropertyStoreTest : public testing::TestWithParam< ::DBus::Variant > { |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 28 | public: |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 29 | // In real code, it's frowned upon to have non-POD static members, as there |
| 30 | // can be ordering issues if your constructors have side effects. |
| 31 | // These constructors don't, and declaring these as static lets me |
| 32 | // autogenerate a bunch of unit test code that I would otherwise need to |
| 33 | // copypasta. So I think it's safe and worth it. |
| 34 | static const ::DBus::Variant kBoolV; |
| 35 | static const ::DBus::Variant kByteV; |
| 36 | static const ::DBus::Variant kInt16V; |
| 37 | static const ::DBus::Variant kInt32V; |
| 38 | static const ::DBus::Variant kStringV; |
| 39 | static const ::DBus::Variant kStringmapV; |
| 40 | static const ::DBus::Variant kStringmapsV; |
| 41 | static const ::DBus::Variant kStringsV; |
Chris Masone | 889666b | 2011-07-03 12:58:50 -0700 | [diff] [blame] | 42 | static const ::DBus::Variant kStrIntPairV; |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 43 | static const ::DBus::Variant kUint16V; |
| 44 | static const ::DBus::Variant kUint32V; |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 45 | |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 46 | PropertyStoreTest(); |
| 47 | virtual ~PropertyStoreTest(); |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 48 | |
| 49 | protected: |
Chris Masone | 2ae797d | 2011-08-23 20:41:00 -0700 | [diff] [blame^] | 50 | ScopedTempDir run_dir_; |
| 51 | ScopedTempDir storage_dir_; |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 52 | MockControl control_interface_; |
| 53 | EventDispatcher dispatcher_; |
| 54 | Manager manager_; |
Chris Masone | 7aa5f90 | 2011-07-11 11:13:35 -0700 | [diff] [blame] | 55 | MockGLib glib_; |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 56 | std::string invalid_args_; |
| 57 | std::string invalid_prop_; |
| 58 | }; |
| 59 | |
| 60 | } // namespace shill |
| 61 | #endif // SHILL_PROPERTY_STORE_UNITTEST_H_ |