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 <memory> 9 #include <string> 10 11 #include "testing/gtest/include/gtest/gtest.h" 12 13 namespace base { 14 class DictionaryValue; 15 class Value; 16 } // namespace base 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 base::Value. 26 // CHECKs if any error occurs. 27 base::Value ReadTestDictionaryValue(const std::string& filename); 28 29 // Deprecated version of the above. 30 std::unique_ptr<base::DictionaryValue> ReadTestDictionary( 31 const std::string& filename); 32 33 // Checks that the pointer |actual| is not NULL but points to a value that 34 // equals |expected|. The intended use case is: 35 // EXPECT_TRUE(test_utils::Equals(expected, actual)); 36 ::testing::AssertionResult Equals(const base::Value* expected, 37 const base::Value* actual); 38 39 } // namespace test_utils 40 } // namespace onc 41 } // namespace chromeos 42 43 #endif // CHROMEOS_NETWORK_ONC_ONC_TEST_UTILS_H_ 44