| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/webui/options/extension_settings_handler.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 "content/common/json_value_serializer.h" | 10 #include "content/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 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 32 scoped_ptr<DictionaryValue> extension_data(DeserializeJSONTestData( | 32 scoped_ptr<DictionaryValue> extension_data(DeserializeJSONTestData( |
| 33 manifest_path, &error)); | 33 manifest_path, &error)); |
| 34 EXPECT_EQ("", error); | 34 EXPECT_EQ("", error); |
| 35 | 35 |
| 36 scoped_refptr<Extension> extension(Extension::Create( | 36 scoped_refptr<Extension> extension(Extension::Create( |
| 37 extension_path, location, *extension_data, | 37 extension_path, location, *extension_data, |
| 38 Extension::REQUIRE_KEY | Extension::STRICT_ERROR_CHECKS, &error)); | 38 Extension::REQUIRE_KEY | Extension::STRICT_ERROR_CHECKS, &error)); |
| 39 EXPECT_TRUE(extension.get()); | 39 EXPECT_TRUE(extension.get()); |
| 40 EXPECT_EQ("", error); | 40 EXPECT_EQ("", error); |
| 41 | 41 |
| 42 return ExtensionsDOMHandler::CreateExtensionDetailValue( | 42 return ExtensionSettingsHandler::CreateExtensionDetailValue( |
| 43 NULL, extension.get(), pages, true, false); | 43 NULL, extension.get(), pages, true, false); |
| 44 } | 44 } |
| 45 | 45 |
| 46 | 46 |
| 47 static void CompareExpectedAndActualOutput( | 47 static void CompareExpectedAndActualOutput( |
| 48 const FilePath& extension_path, | 48 const FilePath& extension_path, |
| 49 const std::vector<ExtensionPage>& pages, | 49 const std::vector<ExtensionPage>& pages, |
| 50 const FilePath& expected_output_path) { | 50 const FilePath& expected_output_path) { |
| 51 std::string error; | 51 std::string error; |
| 52 | 52 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 scoped_ptr<DictionaryValue> extension_details( | 223 scoped_ptr<DictionaryValue> extension_details( |
| 224 CreateExtensionDetailViewFromPath( | 224 CreateExtensionDetailViewFromPath( |
| 225 extension_path, pages, Extension::LOAD)); | 225 extension_path, pages, Extension::LOAD)); |
| 226 | 226 |
| 227 FilePath::StringType ui_path; | 227 FilePath::StringType ui_path; |
| 228 | 228 |
| 229 EXPECT_TRUE(extension_details->GetString("path", &ui_path)); | 229 EXPECT_TRUE(extension_details->GetString("path", &ui_path)); |
| 230 EXPECT_EQ(extension_path, FilePath(ui_path)); | 230 EXPECT_EQ(extension_path, FilePath(ui_path)); |
| 231 } | 231 } |
| 232 | 232 |
| OLD | NEW |