Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1881)

Unified Diff: chromeos/network/onc/onc_test_utils.cc

Issue 11299236: This moves the ONC parsing code into chromeos/network/onc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unit tests Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/network/onc/onc_test_utils.h ('k') | chromeos/network/onc/onc_translation_tables.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "
+ << 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 "
« no previous file with comments | « chromeos/network/onc/onc_test_utils.h ('k') | chromeos/network/onc/onc_translation_tables.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698