property_store_unittest.h revision 6402e501258c9f64373dcd05271c6c7dd75e20bc
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 <base/memory/scoped_temp_dir.h>
13#include <dbus-c++/dbus.h>
14#include <gmock/gmock.h>
15#include <gtest/gtest.h>
16
17#include "shill/dbus_adaptor.h"
18#include "shill/error.h"
19#include "shill/manager.h"
20#include "shill/mock_control.h"
21#include "shill/mock_glib.h"
22#include "shill/property_store.h"
23#include "shill/shill_event.h"
24
25namespace shill {
26
27class PropertyStoreTest : public testing::TestWithParam< ::DBus::Variant > {
28 public:
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;
42  static const ::DBus::Variant kStrIntPairV;
43  static const ::DBus::Variant kUint16V;
44  static const ::DBus::Variant kUint32V;
45
46  PropertyStoreTest();
47  virtual ~PropertyStoreTest();
48
49 protected:
50  ScopedTempDir run_dir_;
51  ScopedTempDir storage_dir_;
52  MockControl control_interface_;
53  EventDispatcher dispatcher_;
54  Manager manager_;
55  MockGLib glib_;
56  std::string invalid_args_;
57  std::string invalid_prop_;
58};
59
60}  // namespace shill
61#endif  // SHILL_PROPERTY_STORE_UNITTEST_H_
62