Chromium Code Reviews| Index: chromeos/network/onc/onc_test_utils.cc |
| diff --git a/chrome/browser/chromeos/network_settings/onc_test_utils.cc b/chromeos/network/onc/onc_test_utils.cc |
| similarity index 74% |
| rename from chrome/browser/chromeos/network_settings/onc_test_utils.cc |
| rename to chromeos/network/onc/onc_test_utils.cc |
| index d76fbfa9d5ddf07fafe521194209ddc4480634a5..0a948bfc432555c6707011f86aee8bb97af24933 100644 |
| --- a/chrome/browser/chromeos/network_settings/onc_test_utils.cc |
| +++ b/chromeos/network/onc/onc_test_utils.cc |
| @@ -2,25 +2,38 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "chrome/browser/chromeos/network_settings/onc_test_utils.h" |
| +#include "chromeos/network/onc/onc_test_utils.h" |
| #include "base/file_path.h" |
| #include "base/json/json_file_value_serializer.h" |
| #include "base/logging.h" |
| #include "base/path_service.h" |
| #include "base/values.h" |
| -#include "chrome/common/chrome_paths.h" |
| +#include "chromeos/chromeos_test_utils.h" |
| namespace chromeos { |
| namespace onc { |
| namespace test_utils { |
| +namespace { |
| + |
| +// The name of the component directory to get the test data from. |
| +const char kNetworkComponentDirectory[] = "network"; |
| + |
| +} // namespace |
| + |
| scoped_ptr<base::DictionaryValue> ReadTestDictionary( |
| const std::string& filename) { |
| + base::DictionaryValue* dict = NULL; |
| FilePath path; |
| - PathService::Get(chrome::DIR_TEST_DATA, &path); |
| - path = path.AppendASCII("chromeos").AppendASCII("network_settings"). |
| - Append(filename); |
| + if (!chromeos::test_utils::GetTestDataPath(kNetworkComponentDirectory, |
| + filename, |
| + &path)) { |
| + NOTREACHED() << "Unable to get test dictionary path for " |
|
pneubeck (no reviews)
2012/12/10 09:33:10
better log a message at the DCHECK in GetTestDataP
|
| + << kNetworkComponentDirectory << "/" << filename; |
| + return make_scoped_ptr(dict); |
| + } |
| + |
| JSONFileValueSerializer serializer(path); |
| serializer.set_allow_trailing_comma(true); |
| @@ -29,7 +42,6 @@ scoped_ptr<base::DictionaryValue> ReadTestDictionary( |
| CHECK(content != NULL) << "Couldn't json-deserialize file '" |
| << filename << "': " << error_message; |
| - base::DictionaryValue* dict = NULL; |
| CHECK(content->GetAsDictionary(&dict)) |
| << "File '" << filename |
| << "' does not contain a dictionary as expected, but type " |