#include "chrome/browser/chromeos/settings/device_settings_service.h"
#include "chrome/browser/drive/drive_app_registry.h"
#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/extensions/test_extension_system.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_profile.h"
#include "content/public/test/test_browser_thread_bundle.h"
+#include "extensions/browser/extension_system.h"
#include "extensions/common/extension_builder.h"
#include "google_apis/drive/drive_api_parser.h"
#include "testing/gtest/include/gtest/gtest.h"
}
TEST(FileManagerFileTasksTest, FindDriveAppTasks) {
+ TestingProfile profile;
// For DriveAppRegistry, which checks CurrentlyOn(BrowserThread::UI).
content::TestBrowserThreadBundle thread_bundle;
// Foo.app can handle "text/plain" and "text/html"
scoped_ptr<google_apis::AppResource> foo_app(new google_apis::AppResource);
- foo_app->set_product_url(
- GURL("https://chrome.google.com/webstore/detail/foo_app_id"));
+ foo_app->set_product_id("foo_app_id");
foo_app->set_application_id("foo_app_id");
foo_app->set_name("Foo");
foo_app->set_object_type("foo_object_type");
// Bar.app can only handle "text/plain".
scoped_ptr<google_apis::AppResource> bar_app(new google_apis::AppResource);
- bar_app->set_product_url(
- GURL("https://chrome.google.com/webstore/detail/bar_app_id"));
+ bar_app->set_product_id("bar_app_id");
bar_app->set_application_id("bar_app_id");
bar_app->set_name("Bar");
bar_app->set_object_type("bar_object_type");
PathAndMimeTypeSet path_mime_set;
path_mime_set.insert(
std::make_pair(
- drive::util::GetDriveMountPointPath().AppendASCII("foo.txt"),
+ drive::util::GetDriveMountPointPath(&profile).AppendASCII("foo.txt"),
"text/plain"));
std::vector<FullTaskDescriptor> tasks;
FindDriveAppTasks(drive_app_registry,
path_mime_set.clear();
path_mime_set.insert(
std::make_pair(
- drive::util::GetDriveMountPointPath().AppendASCII("foo.txt"),
+ drive::util::GetDriveMountPointPath(&profile).AppendASCII("foo.txt"),
"text/plain"));
path_mime_set.insert(
std::make_pair(
- drive::util::GetDriveMountPointPath().AppendASCII("foo.html"),
+ drive::util::GetDriveMountPointPath(&profile).AppendASCII("foo.html"),
"text/html"));
tasks.clear();
FindDriveAppTasks(drive_app_registry,
PathAndMimeTypeSet path_mime_set;
path_mime_set.insert(
std::make_pair(
- drive::util::GetDriveMountPointPath().AppendASCII("foo.txt"),
+ drive::util::GetDriveMountPointPath(&test_profile_).AppendASCII(
+ "foo.txt"),
"text/plain"));
std::vector<FullTaskDescriptor> tasks;
path_mime_set.clear();
path_mime_set.insert(
std::make_pair(
- drive::util::GetDriveMountPointPath().AppendASCII("foo.txt"),
+ drive::util::GetDriveMountPointPath(&test_profile_).AppendASCII(
+ "foo.txt"),
"text/plain"));
path_mime_set.insert(
std::make_pair(
- drive::util::GetDriveMountPointPath().AppendASCII("foo.html"),
+ drive::util::GetDriveMountPointPath(&test_profile_).AppendASCII(
+ "foo.html"),
"text/html"));
tasks.clear();
FindFileHandlerTasks(&test_profile_, path_mime_set, &tasks);
// Baz.app can handle "text/plain".
// This is a Drive app.
scoped_ptr<google_apis::AppResource> baz_app(new google_apis::AppResource);
- baz_app->set_product_url(
- GURL("https://chrome.google.com/webstore/detail/baz_app_id"));
+ baz_app->set_product_id("baz_app_id");
baz_app->set_application_id(kBazId);
baz_app->set_name("Baz");
baz_app->set_object_type("baz_object_type");
std::vector<GURL> file_urls;
path_mime_set.insert(
std::make_pair(
- drive::util::GetDriveMountPointPath().AppendASCII("foo.txt"),
+ drive::util::GetDriveMountPointPath(&test_profile_).AppendASCII(
+ "foo.txt"),
"text/plain"));
file_urls.push_back(GURL("filesystem:chrome-extension://id/dir/foo.txt"));
// Foo.app can handle ".gdoc" files.
scoped_ptr<google_apis::AppResource> foo_app(new google_apis::AppResource);
- foo_app->set_product_url(
- GURL("https://chrome.google.com/webstore/detail/foo_app"));
+ foo_app->set_product_id("foo_app");
foo_app->set_application_id(kFooId);
foo_app->set_name("Foo");
foo_app->set_object_type("foo_object_type");
std::vector<GURL> file_urls;
path_mime_set.insert(
std::make_pair(
- drive::util::GetDriveMountPointPath().AppendASCII("foo.gdoc"),
+ drive::util::GetDriveMountPointPath(&test_profile_).AppendASCII(
+ "foo.gdoc"),
"application/vnd.google-apps.document"));
file_urls.push_back(GURL("filesystem:chrome-extension://id/dir/foo.gdoc"));