Home | History | Annotate | Download | only in onc
      1 // Copyright (c) 2012 The Chromium 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 CHROMEOS_NETWORK_ONC_ONC_TEST_UTILS_H_
      6 #define CHROMEOS_NETWORK_ONC_ONC_TEST_UTILS_H_
      7 
      8 #include <string>
      9 
     10 #include "base/memory/scoped_ptr.h"
     11 #include "testing/gtest/include/gtest/gtest.h"
     12 
     13 namespace base {
     14 class DictionaryValue;
     15 class Value;
     16 }
     17 
     18 namespace chromeos {
     19 namespace onc {
     20 namespace test_utils {
     21 
     22 // Read the file at |filename| as a string. CHECKs if any error occurs.
     23 std::string ReadTestData(const std::string& filename);
     24 
     25 // Read a JSON dictionary from |filename| and return it as a
     26 // DictionaryValue. CHECKs if any error occurs.
     27 scoped_ptr<base::DictionaryValue> ReadTestDictionary(
     28     const std::string& filename);
     29 
     30 // Checks that the pointer |actual| is not NULL but points to a value that
     31 // equals |expected| (using Value::Equals). The intended use case is:
     32 // EXPECT_TRUE(test_utils::Equals(expected, actual));
     33 ::testing::AssertionResult Equals(const base::Value* expected,
     34                                   const base::Value* actual);
     35 
     36 }  // namespace test_utils
     37 }  // namespace onc
     38 }  // namespace chromeos
     39 
     40 #endif  // CHROMEOS_NETWORK_ONC_ONC_TEST_UTILS_H_
     41