Commit 417ce9d3 authored by thestig@chromium.org's avatar thestig@chromium.org

Media Galleries: Enable chrome.mediaGalleriesPrivate.onGalleryChanged and friends on Linux.

BUG=144491

Review URL: https://codereview.chromium.org/282153002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271470 0039d316-1c4b-4281-b951-d872f2087c98
parent 4c513022
...@@ -92,9 +92,8 @@ GalleryWatchStateTracker::~GalleryWatchStateTracker() { ...@@ -92,9 +92,8 @@ GalleryWatchStateTracker::~GalleryWatchStateTracker() {
GalleryWatchStateTracker* GalleryWatchStateTracker::GetForProfile( GalleryWatchStateTracker* GalleryWatchStateTracker::GetForProfile(
Profile* profile) { Profile* profile) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
#if defined(OS_WIN) #if defined(OS_WIN) || defined(OS_LINUX)
// Gallery watch operation is supported only on windows. // Gallery watch operation is not supported on Mac: crbug.com/144491.
// Please refer to crbug.com/144491 for more details.
DCHECK(profile); DCHECK(profile);
MediaGalleriesPrivateAPI* private_api = MediaGalleriesPrivateAPI* private_api =
MediaGalleriesPrivateAPI::Get(profile); MediaGalleriesPrivateAPI::Get(profile);
......
...@@ -194,7 +194,7 @@ void MediaGalleriesPrivateAddGalleryWatchFunction::OnPreferencesInit( ...@@ -194,7 +194,7 @@ void MediaGalleriesPrivateAddGalleryWatchFunction::OnPreferencesInit(
return; return;
} }
#if defined(OS_WIN) #if defined(OS_WIN) || defined(OS_LINUX)
MediaGalleriesPrivateEventRouter* router = MediaGalleriesPrivateEventRouter* router =
MediaGalleriesPrivateAPI::Get(GetProfile())->GetEventRouter(); MediaGalleriesPrivateAPI::Get(GetProfile())->GetEventRouter();
DCHECK(router); DCHECK(router);
...@@ -211,8 +211,8 @@ void MediaGalleriesPrivateAddGalleryWatchFunction::OnPreferencesInit( ...@@ -211,8 +211,8 @@ void MediaGalleriesPrivateAddGalleryWatchFunction::OnPreferencesInit(
this, this,
gallery_pref_id)); gallery_pref_id));
#else #else
// Recursive gallery watch operation is not currently supported on // Recursive gallery watch operation is not currently supported on Mac:
// non-windows platforms. Please refer to crbug.com/144491 for more details. // crbug.com/144491
HandleResponse(gallery_pref_id, false); HandleResponse(gallery_pref_id, false);
#endif #endif
} }
...@@ -250,8 +250,8 @@ bool MediaGalleriesPrivateRemoveGalleryWatchFunction::RunAsync() { ...@@ -250,8 +250,8 @@ bool MediaGalleriesPrivateRemoveGalleryWatchFunction::RunAsync() {
if (!render_view_host() || !render_view_host()->GetProcess()) if (!render_view_host() || !render_view_host()->GetProcess())
return false; return false;
// Remove gallery watch operation is currently supported on windows platforms. // Remove gallery watch operation is currently supported on Mac:
// Please refer to crbug.com/144491 for more details. // crbug.com/144491
scoped_ptr<RemoveGalleryWatch::Params> params( scoped_ptr<RemoveGalleryWatch::Params> params(
RemoveGalleryWatch::Params::Create(*args_)); RemoveGalleryWatch::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get()); EXTENSION_FUNCTION_VALIDATE(params.get());
...@@ -268,7 +268,7 @@ bool MediaGalleriesPrivateRemoveGalleryWatchFunction::RunAsync() { ...@@ -268,7 +268,7 @@ bool MediaGalleriesPrivateRemoveGalleryWatchFunction::RunAsync() {
void MediaGalleriesPrivateRemoveGalleryWatchFunction::OnPreferencesInit( void MediaGalleriesPrivateRemoveGalleryWatchFunction::OnPreferencesInit(
const std::string& pref_id) { const std::string& pref_id) {
#if defined(OS_WIN) #if defined(OS_WIN) || defined(OS_LINUX)
base::FilePath gallery_file_path; base::FilePath gallery_file_path;
MediaGalleryPrefId gallery_pref_id = 0; MediaGalleryPrefId gallery_pref_id = 0;
if (!GetGalleryFilePathAndId(pref_id, if (!GetGalleryFilePathAndId(pref_id,
...@@ -320,7 +320,7 @@ bool MediaGalleriesPrivateGetAllGalleryWatchFunction::RunAsync() { ...@@ -320,7 +320,7 @@ bool MediaGalleriesPrivateGetAllGalleryWatchFunction::RunAsync() {
void MediaGalleriesPrivateGetAllGalleryWatchFunction::OnPreferencesInit() { void MediaGalleriesPrivateGetAllGalleryWatchFunction::OnPreferencesInit() {
std::vector<std::string> result; std::vector<std::string> result;
#if defined(OS_WIN) #if defined(OS_WIN) || defined(OS_LINUX)
GalleryWatchStateTracker* state_tracker = MediaGalleriesPrivateAPI::Get( GalleryWatchStateTracker* state_tracker = MediaGalleriesPrivateAPI::Get(
GetProfile())->GetGalleryWatchStateTracker(); GetProfile())->GetGalleryWatchStateTracker();
MediaGalleryPrefIdSet gallery_ids = MediaGalleryPrefIdSet gallery_ids =
...@@ -357,7 +357,7 @@ bool MediaGalleriesPrivateRemoveAllGalleryWatchFunction::RunAsync() { ...@@ -357,7 +357,7 @@ bool MediaGalleriesPrivateRemoveAllGalleryWatchFunction::RunAsync() {
} }
void MediaGalleriesPrivateRemoveAllGalleryWatchFunction::OnPreferencesInit() { void MediaGalleriesPrivateRemoveAllGalleryWatchFunction::OnPreferencesInit() {
#if defined(OS_WIN) #if defined(OS_WIN) || defined(OS_LINUX)
MediaGalleriesPreferences* preferences = MediaGalleriesPreferences* preferences =
g_browser_process->media_file_system_registry()->GetPreferences( g_browser_process->media_file_system_registry()->GetPreferences(
GetProfile()); GetProfile());
......
...@@ -32,14 +32,14 @@ const char kTestExtensionPath[] = "media_galleries_private/gallerywatch"; ...@@ -32,14 +32,14 @@ const char kTestExtensionPath[] = "media_galleries_private/gallerywatch";
const char kGetAllWatchedGalleryIdsCmd[] = "getAllWatchedGalleryIds()"; const char kGetAllWatchedGalleryIdsCmd[] = "getAllWatchedGalleryIds()";
const char kGetMediaFileSystemsCmd[] = "getMediaFileSystems()"; const char kGetMediaFileSystemsCmd[] = "getMediaFileSystems()";
const char kSetupWatchOnValidGalleriesCmd[] = "setupWatchOnValidGalleries()"; const char kSetupWatchOnValidGalleriesCmd[] = "setupWatchOnValidGalleries()";
#if defined(OS_WIN) #if defined(OS_WIN) || defined(OS_LINUX)
const char kAddGalleryChangedListenerCmd[] = "addGalleryChangedListener()"; const char kAddGalleryChangedListenerCmd[] = "addGalleryChangedListener()";
const char kRemoveAllGalleryWatchCmd[] = "removeAllGalleryWatch()"; const char kRemoveAllGalleryWatchCmd[] = "removeAllGalleryWatch()";
const char kRemoveGalleryChangedListenerCmd[] = const char kRemoveGalleryChangedListenerCmd[] =
"removeGalleryChangedListener()"; "removeGalleryChangedListener()";
const char kRemoveGalleryWatchCmd[] = "removeGalleryWatch()"; const char kRemoveGalleryWatchCmd[] = "removeGalleryWatch()";
const char kSetupWatchOnInvalidGalleryCmd[] = "setupWatchOnInvalidGallery()"; const char kSetupWatchOnInvalidGalleryCmd[] = "setupWatchOnInvalidGallery()";
#endif // defined(OS_WIN) #endif // defined(OS_WIN) || defined(OS_LINUX)
// And JS reply messages. // And JS reply messages.
const char kAddGalleryWatchOK[] = "add_gallery_watch_ok"; const char kAddGalleryWatchOK[] = "add_gallery_watch_ok";
...@@ -47,23 +47,23 @@ const char kGetAllGalleryWatchOK[] = "get_all_gallery_watch_ok"; ...@@ -47,23 +47,23 @@ const char kGetAllGalleryWatchOK[] = "get_all_gallery_watch_ok";
const char kGetMediaFileSystemsCallbackOK[] = const char kGetMediaFileSystemsCallbackOK[] =
"get_media_file_systems_callback_ok"; "get_media_file_systems_callback_ok";
const char kGetMediaFileSystemsOK[] = "get_media_file_systems_ok"; const char kGetMediaFileSystemsOK[] = "get_media_file_systems_ok";
#if defined(OS_WIN) #if defined(OS_WIN) || defined(OS_LINUX)
const char kAddGalleryChangedListenerOK[] = "add_gallery_changed_listener_ok"; const char kAddGalleryChangedListenerOK[] = "add_gallery_changed_listener_ok";
const char kRemoveAllGalleryWatchOK[] = "remove_all_gallery_watch_ok"; const char kRemoveAllGalleryWatchOK[] = "remove_all_gallery_watch_ok";
const char kRemoveGalleryChangedListenerOK[] = const char kRemoveGalleryChangedListenerOK[] =
"remove_gallery_changed_listener_ok"; "remove_gallery_changed_listener_ok";
const char kRemoveGalleryWatchOK[] = "remove_gallery_watch_ok"; const char kRemoveGalleryWatchOK[] = "remove_gallery_watch_ok";
#endif // defined(OS_WIN) #endif // defined(OS_WIN) || defined(OS_LINUX)
// Test reply messages. // Test reply messages.
const char kGetAllGalleryWatchResultA[] = "gallery_watchers_does_not_exists"; const char kGetAllGalleryWatchResultA[] = "gallery_watchers_does_not_exists";
const char kAddGalleryWatchRequestFailed[] = "add_watch_request_failed"; const char kAddGalleryWatchRequestFailed[] = "add_watch_request_failed";
#if defined(OS_WIN) #if defined(OS_WIN) || defined(OS_LINUX)
const char kAddGalleryWatchRequestSucceeded[] = "add_watch_request_succeeded"; const char kAddGalleryWatchRequestSucceeded[] = "add_watch_request_succeeded";
const char kGalleryChangedEventReceived[] = "gallery_changed_event_received"; const char kGalleryChangedEventReceived[] = "gallery_changed_event_received";
const char kGetAllGalleryWatchResultB[] = const char kGetAllGalleryWatchResultB[] =
"watchers_for_galleries_{1, 2, 3}_found"; "watchers_for_galleries_{1, 2, 3}_found";
#endif // defined(OS_WIN) #endif // defined(OS_WIN) || defined(OS_LINUX)
#endif // !defined(OS_CHROMEOS) #endif // !defined(OS_CHROMEOS)
} // namespace } // namespace
...@@ -129,10 +129,7 @@ class MediaGalleriesPrivateGalleryWatchApiTest : public ExtensionApiTest { ...@@ -129,10 +129,7 @@ class MediaGalleriesPrivateGalleryWatchApiTest : public ExtensionApiTest {
}; };
/////////////////////////////////////////////////////////////////////////////// #if defined(OS_WIN) || (defined(OS_LINUX) && !defined(OS_CHROMEOS))
// TESTS //
///////////////////////////////////////////////////////////////////////////////
#if defined(OS_WIN)
IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest, IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest,
BasicGalleryWatch) { BasicGalleryWatch) {
EnsureMediaDirectoriesExists media_directories; EnsureMediaDirectoriesExists media_directories;
...@@ -378,11 +375,10 @@ IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest, ...@@ -378,11 +375,10 @@ IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest,
kGetAllGalleryWatchOK); kGetAllGalleryWatchOK);
EXPECT_TRUE(final_get_all_check_finished.WaitUntilSatisfied()); EXPECT_TRUE(final_get_all_check_finished.WaitUntilSatisfied());
} }
#endif #endif // defined(OS_WIN) || (defined(OS_LINUX) && !defined(OS_CHROMEOS))
#if !defined(OS_WIN) && !defined(OS_CHROMEOS) #if defined(OS_MACOSX)
// Gallery watch request is not enabled on non-windows platforms. // Gallery watch request is not enabled on Mac: crbug.com/144491.
// Please refer to crbug.com/144491.
IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest, IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest,
SetupGalleryWatch) { SetupGalleryWatch) {
EnsureMediaDirectoriesExists media_directories; EnsureMediaDirectoriesExists media_directories;
...@@ -405,8 +401,6 @@ IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest, ...@@ -405,8 +401,6 @@ IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest,
EXPECT_TRUE(gallery_watch_request_finished.WaitUntilSatisfied()); EXPECT_TRUE(gallery_watch_request_finished.WaitUntilSatisfied());
} }
// Gallery watch request is not enabled on non-windows platforms.
// Please refer to crbug.com/144491.
IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest, IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest,
GetAllGalleryWatch) { GetAllGalleryWatch) {
EnsureMediaDirectoriesExists media_directories; EnsureMediaDirectoriesExists media_directories;
...@@ -433,4 +427,4 @@ IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest, ...@@ -433,4 +427,4 @@ IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest,
kGetAllGalleryWatchOK); kGetAllGalleryWatchOK);
EXPECT_TRUE(get_all_gallery_watch_finished.WaitUntilSatisfied()); EXPECT_TRUE(get_all_gallery_watch_finished.WaitUntilSatisfied());
} }
#endif #endif // defined(OS_MACOSX)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment