Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // MediaGalleriesPrivate gallery watch API browser tests. | 5 // MediaGalleries gallery watch API browser tests. |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/files/file_path_watcher.h" | 9 #include "base/files/file_path_watcher.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 15 #include "chrome/browser/extensions/extension_apitest.h" | 15 #include "chrome/browser/extensions/extension_apitest.h" |
| 16 #include "chrome/browser/extensions/extension_service.h" | 16 #include "chrome/browser/extensions/extension_service.h" |
| 17 #include "chrome/browser/extensions/extension_test_message_listener.h" | 17 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| 18 #include "chrome/browser/media_galleries/media_file_system_registry.h" | 18 #include "chrome/browser/media_galleries/media_file_system_registry.h" |
| 19 #include "chrome/browser/media_galleries/media_galleries_preferences.h" | 19 #include "chrome/browser/media_galleries/media_galleries_preferences.h" |
| 20 #include "chrome/browser/media_galleries/media_galleries_test_util.h" | 20 #include "chrome/browser/media_galleries/media_galleries_test_util.h" |
| 21 #include "chrome/common/chrome_paths.h" | 21 #include "chrome/common/chrome_paths.h" |
| 22 #include "content/public/browser/render_frame_host.h" | 22 #include "content/public/browser/render_frame_host.h" |
| 23 #include "content/public/browser/render_view_host.h" | 23 #include "content/public/browser/render_view_host.h" |
| 24 #include "extensions/browser/extension_system.h" | 24 #include "extensions/browser/extension_system.h" |
| 25 #include "extensions/common/extension.h" | 25 #include "extensions/common/extension.h" |
| 26 #include "extensions/common/switches.h" | 26 #include "extensions/common/switches.h" |
| 27 | 27 |
| 28 namespace { | 28 namespace { |
| 29 | 29 |
| 30 // Id of test extension from | 30 // Id of test extension from |
| 31 // chrome/test/data/extensions/api_test/|kTestExtensionPath| | 31 // chrome/test/data/extensions/api_test/|kTestExtensionPath| |
| 32 const char kTestExtensionId[] = "gceegfkgibmgpfopknlcgleimclbknie"; | 32 const char kTestExtensionId[] = "gceegfkgibmgpfopknlcgleimclbknie"; |
| 33 const char kTestExtensionPath[] = "media_galleries_private/gallerywatch"; | 33 const char kTestExtensionPath[] = "media_galleries/gallerywatch"; |
| 34 | 34 |
| 35 // JS commands. | 35 // JS commands. |
| 36 const char kGetAllWatchedGalleryIdsCmd[] = "getAllWatchedGalleryIds()"; | 36 const char kGetAllWatchedGalleryIdsCmd[] = "getAllWatchedGalleryIds()"; |
| 37 const char kGetMediaFileSystemsCmd[] = "getMediaFileSystems()"; | 37 const char kGetMediaFileSystemsCmd[] = "getMediaFileSystems()"; |
| 38 const char kSetupWatchOnValidGalleriesCmd[] = "setupWatchOnValidGalleries()"; | 38 const char kSetupWatchOnValidGalleriesCmd[] = "setupWatchOnValidGalleries()"; |
| 39 const char kSetupWatchOnUnlistenedValidGalleriesCmd[] = | |
| 40 "setupWatchOnUnlistenedValidGalleries()"; | |
| 39 const char kAddGalleryChangedListenerCmd[] = "addGalleryChangedListener()"; | 41 const char kAddGalleryChangedListenerCmd[] = "addGalleryChangedListener()"; |
| 40 const char kRemoveAllGalleryWatchCmd[] = "removeAllGalleryWatch()"; | 42 const char kRemoveAllGalleryWatchCmd[] = "removeAllGalleryWatch()"; |
| 41 const char kRemoveGalleryChangedListenerCmd[] = | 43 const char kRemoveGalleryChangedListenerCmd[] = |
| 42 "removeGalleryChangedListener()"; | 44 "removeGalleryChangedListener()"; |
| 43 const char kRemoveGalleryWatchCmd[] = "removeGalleryWatch()"; | 45 const char kRemoveGalleryWatchCmd[] = "removeGalleryWatch()"; |
| 44 const char kSetupWatchOnInvalidGalleryCmd[] = "setupWatchOnInvalidGallery()"; | 46 const char kSetupWatchOnInvalidGalleryCmd[] = "setupWatchOnInvalidGallery()"; |
| 45 | 47 |
| 46 // And JS reply messages. | 48 // And JS reply messages. |
| 47 const char kAddGalleryWatchOK[] = "add_gallery_watch_ok"; | 49 const char kAddGalleryWatchOK[] = "add_gallery_watch_ok"; |
| 48 const char kGetAllGalleryWatchOK[] = "get_all_gallery_watch_ok"; | 50 const char kGetAllGalleryWatchOK[] = "get_all_gallery_watch_ok"; |
| 49 const char kGetMediaFileSystemsCallbackOK[] = | 51 const char kGetMediaFileSystemsCallbackOK[] = |
| 50 "get_media_file_systems_callback_ok"; | 52 "get_media_file_systems_callback_ok"; |
| 51 const char kGetMediaFileSystemsOK[] = "get_media_file_systems_ok"; | 53 const char kGetMediaFileSystemsOK[] = "get_media_file_systems_ok"; |
| 52 const char kAddGalleryChangedListenerOK[] = "add_gallery_changed_listener_ok"; | 54 const char kAddGalleryChangedListenerOK[] = "add_gallery_changed_listener_ok"; |
| 53 const char kRemoveAllGalleryWatchOK[] = "remove_all_gallery_watch_ok"; | 55 const char kRemoveAllGalleryWatchOK[] = "remove_all_gallery_watch_ok"; |
| 54 const char kRemoveGalleryChangedListenerOK[] = | 56 const char kRemoveGalleryChangedListenerOK[] = |
| 55 "remove_gallery_changed_listener_ok"; | 57 "remove_gallery_changed_listener_ok"; |
| 56 const char kRemoveGalleryWatchOK[] = "remove_gallery_watch_ok"; | 58 const char kRemoveGalleryWatchOK[] = "remove_gallery_watch_ok"; |
| 57 | 59 |
| 58 // Test reply messages. | 60 // Test reply messages. |
| 59 const char kNoGalleryWatchesInstalled[] = "gallery_watchers_does_not_exists"; | 61 const char kNoGalleryWatchesInstalled[] = "gallery_watchers_does_not_exists"; |
| 60 const char kAddGalleryWatchRequestFailed[] = "add_watch_request_failed"; | 62 const char kAddGalleryWatchRequestFailed[] = "add_watch_request_failed"; |
| 63 const char kAddGalleryWatchRequestRuntimeError[] = | |
| 64 "add_watch_request_runtime_error"; | |
| 61 const char kAddGalleryWatchRequestSucceeded[] = "add_watch_request_succeeded"; | 65 const char kAddGalleryWatchRequestSucceeded[] = "add_watch_request_succeeded"; |
| 62 const char kGalleryChangedEventReceived[] = "gallery_changed_event_received"; | 66 const char kGalleryChangedEventReceived[] = "gallery_changed_event_received"; |
| 63 const char kGalleryWatchesCheck[] = "gallery_watcher_checks"; | 67 const char kGalleryWatchesCheck[] = "gallery_watcher_checks"; |
| 64 | 68 |
| 65 } // namespace | 69 } // namespace |
| 66 | 70 |
| 67 | 71 |
| 68 /////////////////////////////////////////////////////////////////////////////// | 72 /////////////////////////////////////////////////////////////////////////////// |
| 69 // MediaGalleriesPrivateGalleryWatchApiTest // | 73 // MediaGalleriesGalleryWatchApiTest // |
| 70 /////////////////////////////////////////////////////////////////////////////// | 74 /////////////////////////////////////////////////////////////////////////////// |
| 71 | 75 |
| 72 class MediaGalleriesPrivateGalleryWatchApiTest : public ExtensionApiTest { | 76 class MediaGalleriesGalleryWatchApiTest : public ExtensionApiTest { |
| 73 public: | 77 public: |
| 74 MediaGalleriesPrivateGalleryWatchApiTest() | 78 MediaGalleriesGalleryWatchApiTest() |
| 75 : extension_(NULL), | 79 : extension_(NULL), |
| 76 background_host_(NULL) { | 80 background_host_(NULL) { |
| 77 } | 81 } |
| 78 virtual ~MediaGalleriesPrivateGalleryWatchApiTest() {} | 82 virtual ~MediaGalleriesGalleryWatchApiTest() {} |
| 79 | 83 |
| 80 protected: | 84 protected: |
| 81 // ExtensionApiTest overrides. | 85 // ExtensionApiTest overrides. |
| 82 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 86 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 83 ExtensionApiTest::SetUpCommandLine(command_line); | 87 ExtensionApiTest::SetUpCommandLine(command_line); |
| 84 command_line->AppendSwitchASCII( | 88 command_line->AppendSwitchASCII( |
| 85 extensions::switches::kWhitelistedExtensionID, | 89 extensions::switches::kWhitelistedExtensionID, |
| 86 kTestExtensionId); | 90 kTestExtensionId); |
| 87 } | 91 } |
| 88 virtual void SetUpOnMainThread() OVERRIDE { | 92 virtual void SetUpOnMainThread() OVERRIDE { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 } | 180 } |
| 177 | 181 |
| 178 scoped_ptr<EnsureMediaDirectoriesExists> ensure_media_directories_exists_; | 182 scoped_ptr<EnsureMediaDirectoriesExists> ensure_media_directories_exists_; |
| 179 | 183 |
| 180 base::ScopedTempDir test_gallery_; | 184 base::ScopedTempDir test_gallery_; |
| 181 | 185 |
| 182 const extensions::Extension* extension_; | 186 const extensions::Extension* extension_; |
| 183 | 187 |
| 184 content::RenderViewHost* background_host_; | 188 content::RenderViewHost* background_host_; |
| 185 | 189 |
| 186 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesPrivateGalleryWatchApiTest); | 190 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesGalleryWatchApiTest); |
| 187 }; | 191 }; |
| 188 | 192 |
| 189 // Crashing on OSX. | 193 // Crashing on OSX. |
| 190 #if defined(OS_MACOSX) | 194 #if defined(OS_MACOSX) |
|
tommycli
2014/08/19 16:36:03
This should not be MAYBE anymore. We should fix th
Oren Blasberg
2014/08/20 22:59:37
Will do that in separate cl.
| |
| 191 #define MAYBE_BasicGalleryWatch DISABLED_BasicGalleryWatch | 195 #define MAYBE_BasicGalleryWatch DISABLED_BasicGalleryWatch |
| 192 #else | 196 #else |
| 193 #define MAYBE_BasicGalleryWatch BasicGalleryWatch | 197 #define MAYBE_BasicGalleryWatch BasicGalleryWatch |
| 194 #endif | 198 #endif |
| 195 IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest, | 199 IN_PROC_BROWSER_TEST_F(MediaGalleriesGalleryWatchApiTest, |
| 196 MAYBE_BasicGalleryWatch) { | 200 MAYBE_BasicGalleryWatch) { |
| 197 SetupGalleryWatches(); | |
| 198 | 201 |
| 199 // Add gallery watch listener. | 202 // Add gallery watch listener. |
| 200 ExecuteCmdAndCheckReply(kAddGalleryChangedListenerCmd, | 203 ExecuteCmdAndCheckReply(kAddGalleryChangedListenerCmd, |
| 201 kAddGalleryChangedListenerOK); | 204 kAddGalleryChangedListenerOK); |
| 202 | 205 |
| 206 SetupGalleryWatches(); | |
| 207 | |
| 203 // Modify gallery contents. | 208 // Modify gallery contents. |
| 204 ExtensionTestMessageListener gallery_change_event_received( | 209 ExtensionTestMessageListener gallery_change_event_received( |
| 205 kGalleryChangedEventReceived, false /* no reply */); | 210 kGalleryChangedEventReceived, false /* no reply */); |
| 211 | |
| 206 ASSERT_TRUE(AddNewFileInTestGallery()); | 212 ASSERT_TRUE(AddNewFileInTestGallery()); |
| 207 if (GalleryWatchesSupported()) | 213 if (GalleryWatchesSupported()) |
| 208 EXPECT_TRUE(gallery_change_event_received.WaitUntilSatisfied()); | 214 EXPECT_TRUE(gallery_change_event_received.WaitUntilSatisfied()); |
| 209 | 215 |
| 210 // Remove gallery watch listener. | 216 // Remove gallery watch listener. |
| 211 ExecuteCmdAndCheckReply(kRemoveGalleryChangedListenerCmd, | 217 ExecuteCmdAndCheckReply(kRemoveGalleryChangedListenerCmd, |
| 212 kRemoveGalleryChangedListenerOK); | 218 kRemoveGalleryChangedListenerOK); |
| 213 | 219 |
| 214 // Remove gallery watch request. | 220 // Remove gallery watch request. |
| 215 if (GalleryWatchesSupported()) | 221 if (GalleryWatchesSupported()) |
| 216 ExecuteCmdAndCheckReply(kRemoveGalleryWatchCmd, kRemoveGalleryWatchOK); | 222 ExecuteCmdAndCheckReply(kRemoveGalleryWatchCmd, kRemoveGalleryWatchOK); |
| 217 } | 223 } |
| 218 | 224 |
| 219 // http://crbug.com/390979 | 225 // http://crbug.com/390979 |
| 220 IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest, | 226 IN_PROC_BROWSER_TEST_F(MediaGalleriesGalleryWatchApiTest, |
| 221 DISABLED_RemoveListenerAndModifyGallery) { | 227 DISABLED_RemoveListenerAndModifyGallery) { |
|
tommycli
2014/08/19 16:36:03
This should not be DISABLED anymore, since we are
Oren Blasberg
2014/08/20 22:59:37
Will remove it in followup CL.
| |
| 222 if (!GalleryWatchesSupported()) | 228 if (!GalleryWatchesSupported()) |
| 223 return; | 229 return; |
| 224 | 230 |
| 225 SetupGalleryWatches(); | 231 SetupGalleryWatches(); |
| 226 | 232 |
| 227 // Add a gallery watch listener. | 233 // Add a gallery watch listener. |
| 228 ExecuteCmdAndCheckReply(kAddGalleryChangedListenerCmd, | 234 ExecuteCmdAndCheckReply(kAddGalleryChangedListenerCmd, |
| 229 kAddGalleryChangedListenerOK); | 235 kAddGalleryChangedListenerOK); |
| 230 // Modify gallery contents. | 236 // Modify gallery contents. |
| 231 ExtensionTestMessageListener gallery_change_event_received( | 237 ExtensionTestMessageListener gallery_change_event_received( |
| 232 kGalleryChangedEventReceived, false /* no reply */); | 238 kGalleryChangedEventReceived, false /* no reply */); |
| 233 ASSERT_TRUE(AddNewFileInTestGallery()); | 239 ASSERT_TRUE(AddNewFileInTestGallery()); |
| 234 EXPECT_TRUE(gallery_change_event_received.WaitUntilSatisfied()); | 240 EXPECT_TRUE(gallery_change_event_received.WaitUntilSatisfied()); |
| 235 | 241 |
| 236 // Remove gallery watch listener. | 242 // Remove gallery watch listener. |
| 237 ExecuteCmdAndCheckReply(kRemoveGalleryChangedListenerCmd, | 243 ExecuteCmdAndCheckReply(kRemoveGalleryChangedListenerCmd, |
| 238 kRemoveGalleryChangedListenerOK); | 244 kRemoveGalleryChangedListenerOK); |
| 239 | 245 |
| 240 // No listener, modify gallery contents. | 246 // No listener, modify gallery contents. |
| 241 ASSERT_TRUE(AddNewFileInTestGallery()); | 247 ASSERT_TRUE(AddNewFileInTestGallery()); |
| 242 | 248 |
| 243 // Remove gallery watch. | 249 // Remove gallery watch. |
| 244 ExecuteCmdAndCheckReply(kRemoveGalleryWatchCmd, kRemoveGalleryWatchOK); | 250 ExecuteCmdAndCheckReply(kRemoveGalleryWatchCmd, kRemoveGalleryWatchOK); |
| 245 } | 251 } |
| 246 | 252 |
| 247 IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest, | 253 IN_PROC_BROWSER_TEST_F(MediaGalleriesGalleryWatchApiTest, |
| 248 SetupGalleryWatchWithoutListeners) { | 254 SetupGalleryWatchWithoutListeners) { |
| 249 if (!GalleryWatchesSupported()) | 255 if (!GalleryWatchesSupported()) |
| 250 return; | 256 return; |
| 251 | 257 |
| 252 SetupGalleryWatches(); | 258 ExtensionTestMessageListener add_watch_runtime_error_received( |
| 253 | 259 kAddGalleryWatchRequestRuntimeError, false /* no reply */); |
| 254 // No listeners, modify gallery contents. | 260 ExecuteCmdAndCheckReply( |
|
tommycli
2014/08/19 16:36:02
This concerns me since you should get multiple mes
Oren Blasberg
2014/08/20 22:59:37
Done.
| |
| 255 ExtensionTestMessageListener gallery_change_event_received( | 261 kSetupWatchOnUnlistenedValidGalleriesCmd, kAddGalleryWatchOK); |
| 256 kGalleryChangedEventReceived, false /* no reply */); | 262 EXPECT_TRUE(add_watch_runtime_error_received.WaitUntilSatisfied()); |
| 257 ASSERT_TRUE(AddNewFileInTestGallery()); | |
| 258 | |
| 259 // Remove gallery watch. | |
| 260 ExecuteCmdAndCheckReply(kRemoveGalleryWatchCmd, kRemoveGalleryWatchOK); | |
| 261 } | 263 } |
| 262 | 264 |
| 263 IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest, | 265 IN_PROC_BROWSER_TEST_F(MediaGalleriesGalleryWatchApiTest, |
| 264 SetupGalleryChangedListenerWithoutWatchers) { | 266 SetupGalleryChangedListenerWithoutWatchers) { |
| 265 // Add gallery watch listener. | 267 // Add gallery watch listener. |
| 266 ExecuteCmdAndCheckReply(kAddGalleryChangedListenerCmd, | 268 ExecuteCmdAndCheckReply(kAddGalleryChangedListenerCmd, |
| 267 kAddGalleryChangedListenerOK); | 269 kAddGalleryChangedListenerOK); |
| 268 | 270 |
| 269 // Modify gallery contents. Listener should not get called because add watch | 271 // Modify gallery contents. Listener should not get called because add watch |
| 270 // request was not called. | 272 // request was not called. |
| 271 ExtensionTestMessageListener gallery_change_event_received( | 273 ExtensionTestMessageListener gallery_change_event_received( |
| 272 kGalleryChangedEventReceived, false /* no reply */); | 274 kGalleryChangedEventReceived, false /* no reply */); |
| 273 ASSERT_TRUE(AddNewFileInTestGallery()); | 275 ASSERT_TRUE(AddNewFileInTestGallery()); |
| 274 | 276 |
| 275 // Remove gallery watch listener. | 277 // Remove gallery watch listener. |
| 276 ExecuteCmdAndCheckReply(kRemoveGalleryChangedListenerCmd, | 278 ExecuteCmdAndCheckReply(kRemoveGalleryChangedListenerCmd, |
| 277 kRemoveGalleryChangedListenerOK); | 279 kRemoveGalleryChangedListenerOK); |
| 278 } | 280 } |
| 279 | 281 |
| 280 IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest, | 282 IN_PROC_BROWSER_TEST_F(MediaGalleriesGalleryWatchApiTest, |
| 281 SetupWatchOnInvalidGallery) { | 283 SetupWatchOnInvalidGallery) { |
| 284 // Add gallery watch listener. | |
| 285 ExecuteCmdAndCheckReply(kAddGalleryChangedListenerCmd, | |
| 286 kAddGalleryChangedListenerOK); | |
| 282 // Set up a invalid gallery watch. | 287 // Set up a invalid gallery watch. |
| 283 ExtensionTestMessageListener invalid_gallery_watch_request_finished( | 288 ExtensionTestMessageListener invalid_gallery_watch_request_finished( |
| 284 kAddGalleryWatchRequestFailed, false /* no reply */); | 289 kAddGalleryWatchRequestFailed, false /* no reply */); |
| 285 ExecuteCmdAndCheckReply(kSetupWatchOnInvalidGalleryCmd, kAddGalleryWatchOK); | 290 ExecuteCmdAndCheckReply(kSetupWatchOnInvalidGalleryCmd, kAddGalleryWatchOK); |
| 286 EXPECT_TRUE(invalid_gallery_watch_request_finished.WaitUntilSatisfied()); | 291 EXPECT_TRUE(invalid_gallery_watch_request_finished.WaitUntilSatisfied()); |
| 287 } | 292 } |
| 288 | 293 |
| 289 IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest, | 294 IN_PROC_BROWSER_TEST_F(MediaGalleriesGalleryWatchApiTest, |
| 290 GetAllGalleryWatch) { | 295 GetAllGalleryWatch) { |
| 296 // Add gallery watch listener. | |
| 297 ExecuteCmdAndCheckReply(kAddGalleryChangedListenerCmd, | |
| 298 kAddGalleryChangedListenerOK); | |
| 299 | |
| 291 // Gallery watchers are not yet added. | 300 // Gallery watchers are not yet added. |
| 292 // chrome.mediaGalleriesPrivate.getAllGalleryWatch should return an empty | 301 // chrome.mediaGalleries.getAllGalleryWatch should return an empty |
| 293 // list. | 302 // list. |
| 294 ExtensionTestMessageListener initial_get_all_check_finished( | 303 ExtensionTestMessageListener initial_get_all_check_finished( |
| 295 kNoGalleryWatchesInstalled, false /* no reply */); | 304 kNoGalleryWatchesInstalled, false /* no reply */); |
| 296 ExecuteCmdAndCheckReply(kGetAllWatchedGalleryIdsCmd, kGetAllGalleryWatchOK); | 305 ExecuteCmdAndCheckReply(kGetAllWatchedGalleryIdsCmd, kGetAllGalleryWatchOK); |
| 297 EXPECT_TRUE(initial_get_all_check_finished.WaitUntilSatisfied()); | 306 EXPECT_TRUE(initial_get_all_check_finished.WaitUntilSatisfied()); |
| 298 | 307 |
| 299 if (!GalleryWatchesSupported()) | 308 if (!GalleryWatchesSupported()) |
| 300 return; | 309 return; |
| 301 | 310 |
| 302 SetupGalleryWatches(); | 311 SetupGalleryWatches(); |
| 303 | 312 |
| 304 // chrome.mediaGalleriesPrivate.getAllGalleryWatch should return the | 313 // chrome.mediaGalleries.getAllGalleryWatch should return the |
| 305 // gallery identifiers. | 314 // gallery identifiers. |
| 306 ExtensionTestMessageListener get_all_watched_galleries_finished( | 315 ExtensionTestMessageListener get_all_watched_galleries_finished( |
| 307 kGalleryWatchesCheck, false /* no reply */); | 316 kGalleryWatchesCheck, false /* no reply */); |
| 308 ExecuteCmdAndCheckReply(kGetAllWatchedGalleryIdsCmd, kGetAllGalleryWatchOK); | 317 ExecuteCmdAndCheckReply(kGetAllWatchedGalleryIdsCmd, kGetAllGalleryWatchOK); |
| 309 EXPECT_TRUE(get_all_watched_galleries_finished.WaitUntilSatisfied()); | 318 EXPECT_TRUE(get_all_watched_galleries_finished.WaitUntilSatisfied()); |
| 310 | 319 |
| 311 // Remove gallery watch request. | 320 // Remove gallery watch request. |
| 312 ExecuteCmdAndCheckReply(kRemoveGalleryWatchCmd, kRemoveGalleryWatchOK); | 321 ExecuteCmdAndCheckReply(kRemoveGalleryWatchCmd, kRemoveGalleryWatchOK); |
| 313 | 322 |
| 314 // Gallery watchers removed. | 323 // Gallery watchers removed. |
| 315 // chrome.mediaGalleriesPrivate.getAllGalleryWatch() should return an empty | 324 // chrome.mediaGalleries.getAllGalleryWatch() should return an empty |
| 316 // list. | 325 // list. |
| 317 ExtensionTestMessageListener final_get_all_check_finished( | 326 ExtensionTestMessageListener final_get_all_check_finished( |
| 318 kNoGalleryWatchesInstalled, false /* no reply */); | 327 kNoGalleryWatchesInstalled, false /* no reply */); |
| 319 ExecuteCmdAndCheckReply(kGetAllWatchedGalleryIdsCmd, kGetAllGalleryWatchOK); | 328 ExecuteCmdAndCheckReply(kGetAllWatchedGalleryIdsCmd, kGetAllGalleryWatchOK); |
| 320 EXPECT_TRUE(final_get_all_check_finished.WaitUntilSatisfied()); | 329 EXPECT_TRUE(final_get_all_check_finished.WaitUntilSatisfied()); |
| 321 } | 330 } |
| 322 | 331 |
| 323 IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest, | 332 IN_PROC_BROWSER_TEST_F(MediaGalleriesGalleryWatchApiTest, |
| 324 RemoveAllGalleryWatch) { | 333 RemoveAllGalleryWatch) { |
| 334 // Add gallery watch listener. | |
| 335 ExecuteCmdAndCheckReply(kAddGalleryChangedListenerCmd, | |
| 336 kAddGalleryChangedListenerOK); | |
| 337 | |
| 325 if (!GalleryWatchesSupported()) | 338 if (!GalleryWatchesSupported()) |
| 326 return; | 339 return; |
| 327 | 340 |
| 328 SetupGalleryWatches(); | 341 SetupGalleryWatches(); |
| 329 | 342 |
| 330 // chrome.mediaGalleriesPrivate.getAllGalleryWatch should return the watched | 343 // chrome.mediaGalleries.getAllGalleryWatch should return the watched |
| 331 // gallery identifiers. | 344 // gallery identifiers. |
| 332 ExtensionTestMessageListener get_all_watched_galleries_finished( | 345 ExtensionTestMessageListener get_all_watched_galleries_finished( |
| 333 kGalleryWatchesCheck, false /* no reply */); | 346 kGalleryWatchesCheck, false /* no reply */); |
| 334 ExecuteCmdAndCheckReply(kGetAllWatchedGalleryIdsCmd, kGetAllGalleryWatchOK); | 347 ExecuteCmdAndCheckReply(kGetAllWatchedGalleryIdsCmd, kGetAllGalleryWatchOK); |
| 335 EXPECT_TRUE(get_all_watched_galleries_finished.WaitUntilSatisfied()); | 348 EXPECT_TRUE(get_all_watched_galleries_finished.WaitUntilSatisfied()); |
| 336 | 349 |
| 337 // Remove all gallery watchers. | 350 // Remove all gallery watchers. |
| 338 ExecuteCmdAndCheckReply(kRemoveAllGalleryWatchCmd, kRemoveAllGalleryWatchOK); | 351 ExecuteCmdAndCheckReply(kRemoveAllGalleryWatchCmd, kRemoveAllGalleryWatchOK); |
| 339 | 352 |
| 340 // Gallery watchers removed. chrome.mediaGalleriesPrivate.getAllGalleryWatch | 353 // Gallery watchers removed. chrome.mediaGalleries.getAllGalleryWatch |
| 341 // should return an empty list. | 354 // should return an empty list. |
| 342 ExtensionTestMessageListener final_get_all_check_finished( | 355 ExtensionTestMessageListener final_get_all_check_finished( |
| 343 kNoGalleryWatchesInstalled, false /* no reply */); | 356 kNoGalleryWatchesInstalled, false /* no reply */); |
| 344 ExecuteCmdAndCheckReply(kGetAllWatchedGalleryIdsCmd, kGetAllGalleryWatchOK); | 357 ExecuteCmdAndCheckReply(kGetAllWatchedGalleryIdsCmd, kGetAllGalleryWatchOK); |
| 345 EXPECT_TRUE(final_get_all_check_finished.WaitUntilSatisfied()); | 358 EXPECT_TRUE(final_get_all_check_finished.WaitUntilSatisfied()); |
| 346 } | 359 } |
| OLD | NEW |