summaryrefslogtreecommitdiffstats
path: root/chromeos/network/onc/onc_test_utils.h
blob: 221318631cb8d991e6fbd5fccb2ad27bba1da91b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROMEOS_NETWORK_ONC_ONC_TEST_UTILS_H_
#define CHROMEOS_NETWORK_ONC_ONC_TEST_UTILS_H_

#include <string>

#include "base/memory/scoped_ptr.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace base {
class DictionaryValue;
class Value;
}

namespace chromeos {
namespace onc {
namespace test_utils {

// Read the file at |filename| as a string. CHECKs if any error occurs.
std::string ReadTestData(const std::string& filename);

// Read a JSON dictionary from |filename| and return it as a
// DictionaryValue. CHECKs if any error occurs.
scoped_ptr<base::DictionaryValue> ReadTestDictionary(
    const std::string& filename);

// Checks that the pointer |actual| is not NULL but points to a value that
// equals |expected| (using Value::Equals). The intended use case is:
// EXPECT_TRUE(test_utils::Equals(expected, actual));
::testing::AssertionResult Equals(const base::Value* expected,
                                  const base::Value* actual);

}  // namespace test_utils
}  // namespace onc
}  // namespace chromeos

#endif  // CHROMEOS_NETWORK_ONC_ONC_TEST_UTILS_H_