| 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" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 std::string error; | 37 std::string error; |
| 38 | 38 |
| 39 FilePath manifest_path = extension_path.AppendASCII( | 39 FilePath manifest_path = extension_path.AppendASCII( |
| 40 Extension::kManifestFilename); | 40 Extension::kManifestFilename); |
| 41 scoped_ptr<DictionaryValue> extension_data(DeserializeJSONTestData( | 41 scoped_ptr<DictionaryValue> extension_data(DeserializeJSONTestData( |
| 42 manifest_path, &error)); | 42 manifest_path, &error)); |
| 43 EXPECT_EQ("", error); | 43 EXPECT_EQ("", error); |
| 44 EXPECT_TRUE(extension.InitFromValue(*extension_data, true, &error)); | 44 EXPECT_TRUE(extension.InitFromValue(*extension_data, true, &error)); |
| 45 EXPECT_EQ("", error); | 45 EXPECT_EQ("", error); |
| 46 | 46 |
| 47 scoped_ptr<DictionaryValue>expected_output_data(DeserializeJSONTestData( | 47 scoped_ptr<DictionaryValue> expected_output_data(DeserializeJSONTestData( |
| 48 expected_output_path, &error)); | 48 expected_output_path, &error)); |
| 49 EXPECT_EQ("", error); | 49 EXPECT_EQ("", error); |
| 50 | 50 |
| 51 // Produce test output. | 51 // Produce test output. |
| 52 scoped_ptr<DictionaryValue> actual_output_data( | 52 scoped_ptr<DictionaryValue> actual_output_data( |
| 53 ExtensionsDOMHandler::CreateExtensionDetailValue(&extension, pages)); | 53 ExtensionsDOMHandler::CreateExtensionDetailValue(&extension, pages, |
| 54 true)); |
| 54 | 55 |
| 55 // Compare the outputs. | 56 // Compare the outputs. |
| 56 return expected_output_data->Equals(actual_output_data.get()); | 57 return expected_output_data->Equals(actual_output_data.get()); |
| 57 } | 58 } |
| 58 } // namespace | 59 } // namespace |
| 59 | 60 |
| 60 class ExtensionUITest : public testing::Test { | 61 class ExtensionUITest : public testing::Test { |
| 61 }; | 62 }; |
| 62 | 63 |
| 63 TEST(ExtensionUITest, GenerateExtensionsJSONData) { | 64 TEST(ExtensionUITest, GenerateExtensionsJSONData) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 expected_output_path = data_test_dir_path.AppendASCII("extensions") | 116 expected_output_path = data_test_dir_path.AppendASCII("extensions") |
| 116 .AppendASCII("ui") | 117 .AppendASCII("ui") |
| 117 .AppendASCII("create_extension_detail_value_expected_output") | 118 .AppendASCII("create_extension_detail_value_expected_output") |
| 118 .AppendASCII("good-extension3.json"); | 119 .AppendASCII("good-extension3.json"); |
| 119 | 120 |
| 120 pages.clear(); | 121 pages.clear(); |
| 121 | 122 |
| 122 EXPECT_TRUE(CompareExpectedAndActualOutput(extension_path, pages, | 123 EXPECT_TRUE(CompareExpectedAndActualOutput(extension_path, pages, |
| 123 expected_output_path)) << extension_path.value(); | 124 expected_output_path)) << extension_path.value(); |
| 124 } | 125 } |
| OLD | NEW |