| 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 #include "chromeos/network/onc/onc_test_utils.h" | 5 #include "chromeos/network/onc/onc_test_utils.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/json/json_file_value_serializer.h" | 9 #include "base/json/json_file_value_serializer.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 CHECK(content != NULL) << "Couldn't json-deserialize file '" | 57 CHECK(content != NULL) << "Couldn't json-deserialize file '" |
| 58 << filename << "': " << error_message; | 58 << filename << "': " << error_message; |
| 59 | 59 |
| 60 CHECK(content->GetAsDictionary(&dict)) | 60 CHECK(content->GetAsDictionary(&dict)) |
| 61 << "File '" << filename | 61 << "File '" << filename |
| 62 << "' does not contain a dictionary as expected, but type " | 62 << "' does not contain a dictionary as expected, but type " |
| 63 << content->GetType(); | 63 << content->GetType(); |
| 64 return make_scoped_ptr(dict); | 64 return make_scoped_ptr(dict); |
| 65 } | 65 } |
| 66 | 66 |
| 67 ::testing::AssertionResult Equals(const base::DictionaryValue* expected, | 67 ::testing::AssertionResult Equals(const base::Value* expected, |
| 68 const base::DictionaryValue* actual) { | 68 const base::Value* actual) { |
| 69 CHECK(expected != NULL); | 69 CHECK(expected != NULL); |
| 70 if (actual == NULL) | 70 if (actual == NULL) |
| 71 return ::testing::AssertionFailure() << "Actual dictionary pointer is NULL"; | 71 return ::testing::AssertionFailure() << "Actual value pointer is NULL"; |
| 72 | 72 |
| 73 if (expected->Equals(actual)) | 73 if (expected->Equals(actual)) |
| 74 return ::testing::AssertionSuccess() << "Dictionaries are equal"; | 74 return ::testing::AssertionSuccess() << "Values are equal"; |
| 75 | 75 |
| 76 return ::testing::AssertionFailure() << "Dictionaries are unequal.\n" | 76 return ::testing::AssertionFailure() << "Values are unequal.\n" |
| 77 << "Expected dictionary:\n" << *expected | 77 << "Expected value:\n" << *expected |
| 78 << "Actual dictionary:\n" << *actual; | 78 << "Actual value:\n" << *actual; |
| 79 } | 79 } |
| 80 | 80 |
| 81 } // namespace test_utils | 81 } // namespace test_utils |
| 82 } // namespace onc | 82 } // namespace onc |
| 83 } // namespace chromeos | 83 } // namespace chromeos |
| OLD | NEW |