| Index: chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc
|
| diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc b/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc
|
| index 43b9f205850b76bb16ff7f88fccd53292bb5c0af..1e2af47eb12e3efe9a07a5183fa474c7417d091e 100644
|
| --- a/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc
|
| +++ b/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc
|
| @@ -264,4 +264,36 @@ TEST_F(DeveloperPrivateApiUnitTest, DeveloperPrivatePackFunction) {
|
| base::DeleteFile(pem_path, false);
|
| }
|
|
|
| +// Test developerPrivate.requestFileSource.
|
| +TEST_F(DeveloperPrivateApiUnitTest, DeveloperPrivateRequestFileSource) {
|
| + ResetThreadBundle(content::TestBrowserThreadBundle::DEFAULT);
|
| + // Testing of this function seems light, but that's because it basically just
|
| + // forwards to reading a file to a string, and highlighting it - both of which
|
| + // are already tested separately.
|
| + const Extension* extension = LoadUnpackedExtension();
|
| + const char kErrorMessage[] = "Something went wrong";
|
| + api::developer_private::RequestFileSourceProperties properties;
|
| + properties.extension_id = extension->id();
|
| + properties.path_suffix = "manifest.json";
|
| + properties.message = kErrorMessage;
|
| + properties.manifest_key.reset(new std::string("name"));
|
| +
|
| + scoped_refptr<UIThreadExtensionFunction> function(
|
| + new api::DeveloperPrivateRequestFileSourceFunction());
|
| + base::ListValue file_source_args;
|
| + file_source_args.Append(properties.ToValue().release());
|
| + EXPECT_TRUE(RunFunction(function, file_source_args)) << function->GetError();
|
| +
|
| + const base::Value* response_value = nullptr;
|
| + ASSERT_TRUE(function->GetResultList()->Get(0u, &response_value));
|
| + scoped_ptr<api::developer_private::RequestFileSourceResponse> response =
|
| + api::developer_private::RequestFileSourceResponse::FromValue(
|
| + *response_value);
|
| + EXPECT_FALSE(response->before_highlight.empty());
|
| + EXPECT_EQ("\"name\": \"foo\"", response->highlight);
|
| + EXPECT_FALSE(response->after_highlight.empty());
|
| + EXPECT_EQ("foo: manifest.json", response->title);
|
| + EXPECT_EQ(kErrorMessage, response->message);
|
| +}
|
| +
|
| } // namespace extensions
|
|
|