| Index: chrome/browser/chromeos/extensions/file_manager/file_tasks_unittest.cc
|
| diff --git a/chrome/browser/chromeos/extensions/file_manager/file_tasks_unittest.cc b/chrome/browser/chromeos/extensions/file_manager/file_tasks_unittest.cc
|
| index ebd249f2b253cd4537a78d77b928dc6a82a24127..45a9061080337ba98d7de832833fda2383355510 100644
|
| --- a/chrome/browser/chromeos/extensions/file_manager/file_tasks_unittest.cc
|
| +++ b/chrome/browser/chromeos/extensions/file_manager/file_tasks_unittest.cc
|
| @@ -4,11 +4,77 @@
|
|
|
| #include "chrome/browser/chromeos/extensions/file_manager/file_tasks.h"
|
|
|
| +#include "base/values.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| namespace file_manager {
|
| namespace file_tasks {
|
|
|
| +TEST(FileManagerFileTasksTest,
|
| + FullTaskDescriptor_NonDriveAppWithIconAndDefault) {
|
| + FullTaskDescriptor full_descriptor(
|
| + TaskDescriptor("app-id",
|
| + TASK_TYPE_FILE_BROWSER_HANDLER,
|
| + "action-id"),
|
| + "task title",
|
| + GURL("http://example.com/icon.png"),
|
| + true /* is_default */);
|
| +
|
| + scoped_ptr<base::DictionaryValue> dictionary(
|
| + full_descriptor.AsDictionaryValue());
|
| + std::string task_id;
|
| + EXPECT_TRUE(dictionary->GetString("taskId", &task_id));
|
| + EXPECT_EQ("app-id|file|action-id", task_id);
|
| +
|
| + std::string icon_url;
|
| + EXPECT_TRUE(dictionary->GetString("iconUrl", &icon_url));
|
| + EXPECT_EQ("http://example.com/icon.png", icon_url);
|
| +
|
| + std::string title;
|
| + EXPECT_TRUE(dictionary->GetString("title", &title));
|
| + EXPECT_EQ("task title", title);
|
| +
|
| + bool is_drive_app = false;
|
| + EXPECT_TRUE(dictionary->GetBoolean("driveApp", &is_drive_app));
|
| + EXPECT_FALSE(is_drive_app);
|
| +
|
| + bool is_default = false;
|
| + EXPECT_TRUE(dictionary->GetBoolean("isDefault", &is_default));
|
| + EXPECT_TRUE(is_default);
|
| +}
|
| +
|
| +TEST(FileManagerFileTasksTest,
|
| + FullTaskDescriptor_DriveAppWithoutIconAndNotDefault) {
|
| + FullTaskDescriptor full_descriptor(
|
| + TaskDescriptor("app-id",
|
| + TASK_TYPE_DRIVE_APP,
|
| + "action-id"),
|
| + "task title",
|
| + GURL(), // No icon URL.
|
| + false /* is_default */);
|
| +
|
| + scoped_ptr<base::DictionaryValue> dictionary(
|
| + full_descriptor.AsDictionaryValue());
|
| + std::string task_id;
|
| + EXPECT_TRUE(dictionary->GetString("taskId", &task_id));
|
| + EXPECT_EQ("app-id|drive|action-id", task_id);
|
| +
|
| + std::string icon_url;
|
| + EXPECT_FALSE(dictionary->GetString("iconUrl", &icon_url));
|
| +
|
| + std::string title;
|
| + EXPECT_TRUE(dictionary->GetString("title", &title));
|
| + EXPECT_EQ("task title", title);
|
| +
|
| + bool is_drive_app = false;
|
| + EXPECT_TRUE(dictionary->GetBoolean("driveApp", &is_drive_app));
|
| + EXPECT_TRUE(is_drive_app);
|
| +
|
| + bool is_default = false;
|
| + EXPECT_TRUE(dictionary->GetBoolean("isDefault", &is_default));
|
| + EXPECT_FALSE(is_default);
|
| +}
|
| +
|
| TEST(FileManagerFileTasksTest, MakeTaskID) {
|
| EXPECT_EQ("app-id|file|action-id",
|
| MakeTaskID("app-id", TASK_TYPE_FILE_BROWSER_HANDLER, "action-id"));
|
| @@ -22,6 +88,13 @@ TEST(FileManagerFileTasksTest, MakeDriveAppTaskId) {
|
| EXPECT_EQ("app-id|drive|open-with", MakeDriveAppTaskId("app-id"));
|
| }
|
|
|
| +TEST(FileManagerFileTasksTest, TaskDescriptorToId) {
|
| + EXPECT_EQ("app-id|file|action-id",
|
| + TaskDescriptorToId(TaskDescriptor("app-id",
|
| + TASK_TYPE_FILE_BROWSER_HANDLER,
|
| + "action-id")));
|
| +}
|
| +
|
| TEST(FileManagerFileTasksTest, ParseTaskID_FileBrowserHandler) {
|
| TaskDescriptor task;
|
| EXPECT_TRUE(ParseTaskID("app-id|file|action-id", &task));
|
|
|