blob: 6e451c5fdbdc3ffc4d92dd1b9ab895526ff5fc6f [file] [log] [blame]
Chris Masone3bd3c8c2011-06-13 08:20:26 -07001// 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 Masone2ae797d2011-08-23 20:41:00 -070012#include <base/memory/scoped_temp_dir.h>
Chris Masone3bd3c8c2011-06-13 08:20:26 -070013#include <dbus-c++/dbus.h>
Chris Masone7156c922011-08-23 20:36:21 -070014#include <gmock/gmock.h>
Chris Masone2ae797d2011-08-23 20:41:00 -070015#include <gtest/gtest.h>
Chris Masone3bd3c8c2011-06-13 08:20:26 -070016
17#include "shill/dbus_adaptor.h"
18#include "shill/error.h"
19#include "shill/manager.h"
20#include "shill/mock_control.h"
Chris Masone7aa5f902011-07-11 11:13:35 -070021#include "shill/mock_glib.h"
Chris Masoneb925cc82011-06-22 15:39:57 -070022#include "shill/property_store.h"
Chris Masone3bd3c8c2011-06-13 08:20:26 -070023#include "shill/shill_event.h"
24
25namespace shill {
26
Chris Masoneb925cc82011-06-22 15:39:57 -070027class PropertyStoreTest : public testing::TestWithParam< ::DBus::Variant > {
Chris Masone3bd3c8c2011-06-13 08:20:26 -070028 public:
Chris Masoneb925cc82011-06-22 15:39:57 -070029 // 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 Masone889666b2011-07-03 12:58:50 -070042 static const ::DBus::Variant kStrIntPairV;
Chris Masoneb925cc82011-06-22 15:39:57 -070043 static const ::DBus::Variant kUint16V;
44 static const ::DBus::Variant kUint32V;
Chris Masone3bd3c8c2011-06-13 08:20:26 -070045
Chris Masoneb925cc82011-06-22 15:39:57 -070046 PropertyStoreTest();
47 virtual ~PropertyStoreTest();
Chris Masone3bd3c8c2011-06-13 08:20:26 -070048
49 protected:
Chris Masone2ae797d2011-08-23 20:41:00 -070050 ScopedTempDir run_dir_;
51 ScopedTempDir storage_dir_;
Chris Masone3bd3c8c2011-06-13 08:20:26 -070052 MockControl control_interface_;
53 EventDispatcher dispatcher_;
54 Manager manager_;
Chris Masone7aa5f902011-07-11 11:13:35 -070055 MockGLib glib_;
Chris Masone3bd3c8c2011-06-13 08:20:26 -070056 std::string invalid_args_;
57 std::string invalid_prop_;
58};
59
60} // namespace shill
61#endif // SHILL_PROPERTY_STORE_UNITTEST_H_