| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 "base/path_service.h" | 5 #include "base/path_service.h" |
| 6 #include "base/string_util.h" | 6 #include "base/string_util.h" |
| 7 #include "chrome/browser/extensions/extensions_ui.h" | 7 #include "chrome/browser/extensions/extensions_ui.h" |
| 8 #include "chrome/common/chrome_paths.h" | 8 #include "chrome/common/chrome_paths.h" |
| 9 #include "chrome/common/extensions/extension.h" | 9 #include "chrome/common/extensions/extension.h" |
| 10 #include "chrome/common/json_value_serializer.h" | 10 #include "chrome/common/json_value_serializer.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 static DictionaryValue* DeserializeJSONTestData(const FilePath& path, | 14 static DictionaryValue* DeserializeJSONTestData(const FilePath& path, |
| 15 std::string *error) { | 15 std::string *error) { |
| 16 Value* value; | 16 Value* value; |
| 17 | 17 |
| 18 JSONFileValueSerializer serializer(path); | 18 JSONFileValueSerializer serializer(path); |
| 19 value = serializer.Deserialize(error); | 19 value = serializer.Deserialize(NULL, error); |
| 20 | 20 |
| 21 return static_cast<DictionaryValue*>(value); | 21 return static_cast<DictionaryValue*>(value); |
| 22 } | 22 } |
| 23 | 23 |
| 24 static bool CompareExpectedAndActualOutput( | 24 static bool CompareExpectedAndActualOutput( |
| 25 const FilePath& extension_path, | 25 const FilePath& extension_path, |
| 26 const std::vector<ExtensionPage>& pages, | 26 const std::vector<ExtensionPage>& pages, |
| 27 const FilePath& expected_output_path) { | 27 const FilePath& expected_output_path) { |
| 28 // TODO(rafaelw): Using the extension_path passed in above, causes this | 28 // TODO(rafaelw): Using the extension_path passed in above, causes this |
| 29 // unit test to fail on linux. The Values come back valid, but the | 29 // unit test to fail on linux. The Values come back valid, but the |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 expected_output_path = data_test_dir_path.AppendASCII("extensions") | 113 expected_output_path = data_test_dir_path.AppendASCII("extensions") |
| 114 .AppendASCII("ui") | 114 .AppendASCII("ui") |
| 115 .AppendASCII("create_extension_detail_value_expected_output") | 115 .AppendASCII("create_extension_detail_value_expected_output") |
| 116 .AppendASCII("good-extension3.json"); | 116 .AppendASCII("good-extension3.json"); |
| 117 | 117 |
| 118 pages.clear(); | 118 pages.clear(); |
| 119 | 119 |
| 120 EXPECT_TRUE(CompareExpectedAndActualOutput(extension_path, pages, | 120 EXPECT_TRUE(CompareExpectedAndActualOutput(extension_path, pages, |
| 121 expected_output_path)) << extension_path.value(); | 121 expected_output_path)) << extension_path.value(); |
| 122 } | 122 } |
| OLD | NEW |