OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROMEOS_NETWORK_ONC_ONC_TEST_UTILS_H_ | 5 #ifndef CHROMEOS_NETWORK_ONC_ONC_TEST_UTILS_H_ |
6 #define CHROMEOS_NETWORK_ONC_ONC_TEST_UTILS_H_ | 6 #define CHROMEOS_NETWORK_ONC_ONC_TEST_UTILS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 namespace base { | 13 namespace base { |
14 class DictionaryValue; | 14 class DictionaryValue; |
| 15 class Value; |
15 } | 16 } |
16 | 17 |
17 namespace chromeos { | 18 namespace chromeos { |
18 namespace onc { | 19 namespace onc { |
19 namespace test_utils { | 20 namespace test_utils { |
20 | 21 |
21 // Read the file at |filename| as a string. CHECKs if any error occurs. | 22 // Read the file at |filename| as a string. CHECKs if any error occurs. |
22 std::string ReadTestData(const std::string& filename); | 23 std::string ReadTestData(const std::string& filename); |
23 | 24 |
24 // Read a JSON dictionary from |filename| and return it as a | 25 // Read a JSON dictionary from |filename| and return it as a |
25 // DictionaryValue. CHECKs if any error occurs. | 26 // DictionaryValue. CHECKs if any error occurs. |
26 scoped_ptr<base::DictionaryValue> ReadTestDictionary( | 27 scoped_ptr<base::DictionaryValue> ReadTestDictionary( |
27 const std::string& filename); | 28 const std::string& filename); |
28 | 29 |
29 // Checks that the pointer |actual| is not NULL but points to a dictionary that | 30 // Checks that the pointer |actual| is not NULL but points to a value that |
30 // equals |expected| (using Value::Equals). The intended use case is: | 31 // equals |expected| (using Value::Equals). The intended use case is: |
31 // EXPECT_TRUE(test_utils::Equals(expected, actual)); | 32 // EXPECT_TRUE(test_utils::Equals(expected, actual)); |
32 ::testing::AssertionResult Equals(const base::DictionaryValue* expected, | 33 ::testing::AssertionResult Equals(const base::Value* expected, |
33 const base::DictionaryValue* actual); | 34 const base::Value* actual); |
34 | 35 |
35 } // namespace test_utils | 36 } // namespace test_utils |
36 } // namespace onc | 37 } // namespace onc |
37 } // namespace chromeos | 38 } // namespace chromeos |
38 | 39 |
39 #endif // CHROMEOS_NETWORK_ONC_ONC_TEST_UTILS_H_ | 40 #endif // CHROMEOS_NETWORK_ONC_ONC_TEST_UTILS_H_ |
OLD | NEW |