blob: f4aa0840a5af2c6fa5473c1e3b400f8972d9a545 [file] [log] [blame]
Alex Deymo391ad9f2014-01-29 14:36:20 -08001// Copyright (c) 2014 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#include <gtest/gtest.h>
6
7#include "policy_manager/variable.h"
8
9using std::string;
10
11namespace chromeos_policy_manager {
12
13// Variable class that returns a value constructed with the default value.
14template <typename T>
15class DefaultVariable : public Variable<T> {
16 public:
17 DefaultVariable(const string& name) : Variable<T>(name) {}
18 virtual ~DefaultVariable() {}
19
20 protected:
21 virtual const T* GetValue(base::TimeDelta /* timeout */,
22 string* /* errmsg */) {
23 return new T();
24 }
25
26 private:
27 DISALLOW_COPY_AND_ASSIGN(DefaultVariable);
28};
29
30TEST(PmBaseVariableTest, GetNameTest) {
31 DefaultVariable<int> var("var");
32 EXPECT_EQ(var.GetName(), string("var"));
33}
34
35} // namespace chromeos_policy_manager