OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // MediaGalleries 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" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 | 185 |
186 base::ScopedTempDir test_gallery_; | 186 base::ScopedTempDir test_gallery_; |
187 | 187 |
188 const extensions::Extension* extension_; | 188 const extensions::Extension* extension_; |
189 | 189 |
190 content::RenderViewHost* background_host_; | 190 content::RenderViewHost* background_host_; |
191 | 191 |
192 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesGalleryWatchApiTest); | 192 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesGalleryWatchApiTest); |
193 }; | 193 }; |
194 | 194 |
195 // Crashing on OSX. | 195 IN_PROC_BROWSER_TEST_F(MediaGalleriesGalleryWatchApiTest, BasicGalleryWatch) { |
196 #if defined(OS_MACOSX) | |
197 #define MAYBE_BasicGalleryWatch DISABLED_BasicGalleryWatch | |
198 #else | |
199 #define MAYBE_BasicGalleryWatch BasicGalleryWatch | |
200 #endif | |
201 IN_PROC_BROWSER_TEST_F(MediaGalleriesGalleryWatchApiTest, | |
202 MAYBE_BasicGalleryWatch) { | |
203 // Add gallery watch listener. | 196 // Add gallery watch listener. |
204 ExecuteCmdAndCheckReply(kAddGalleryChangedListenerCmd, | 197 ExecuteCmdAndCheckReply(kAddGalleryChangedListenerCmd, |
205 kAddGalleryChangedListenerOK); | 198 kAddGalleryChangedListenerOK); |
206 | 199 |
207 SetupGalleryWatches(); | 200 SetupGalleryWatches(); |
208 | 201 |
209 // Modify gallery contents. | 202 // Modify gallery contents. |
210 ExtensionTestMessageListener gallery_change_event_received( | 203 ExtensionTestMessageListener gallery_change_event_received( |
211 kGalleryChangedEventReceived, false /* no reply */); | 204 kGalleryChangedEventReceived, false /* no reply */); |
212 | 205 |
(...skipping 21 matching lines...) Expand all Loading... |
234 SetupGalleryWatches(); | 227 SetupGalleryWatches(); |
235 | 228 |
236 | 229 |
237 // Modify gallery contents; expect correct details. | 230 // Modify gallery contents; expect correct details. |
238 ExtensionTestMessageListener got_correct_details( | 231 ExtensionTestMessageListener got_correct_details( |
239 kOnGalleryChangedCheckingOK, false); | 232 kOnGalleryChangedCheckingOK, false); |
240 ASSERT_TRUE(AddNewFileInTestGallery()); | 233 ASSERT_TRUE(AddNewFileInTestGallery()); |
241 EXPECT_TRUE(got_correct_details.WaitUntilSatisfied()); | 234 EXPECT_TRUE(got_correct_details.WaitUntilSatisfied()); |
242 } | 235 } |
243 | 236 |
244 // http://crbug.com/390979 | |
245 IN_PROC_BROWSER_TEST_F(MediaGalleriesGalleryWatchApiTest, | 237 IN_PROC_BROWSER_TEST_F(MediaGalleriesGalleryWatchApiTest, |
246 DISABLED_RemoveListenerAndModifyGallery) { | 238 RemoveListenerAndModifyGallery) { |
247 if (!GalleryWatchesSupported()) | 239 if (!GalleryWatchesSupported()) |
248 return; | 240 return; |
249 | 241 |
250 // Add a gallery watch listener. | 242 // Add a gallery watch listener. |
251 ExecuteCmdAndCheckReply(kAddGalleryChangedListenerCmd, | 243 ExecuteCmdAndCheckReply(kAddGalleryChangedListenerCmd, |
252 kAddGalleryChangedListenerOK); | 244 kAddGalleryChangedListenerOK); |
253 SetupGalleryWatches(); | 245 SetupGalleryWatches(); |
254 | 246 |
255 // Modify gallery contents. | 247 // Modify gallery contents. |
256 ExtensionTestMessageListener gallery_change_event_received( | 248 ExtensionTestMessageListener gallery_change_event_received( |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 // Remove all gallery watchers. | 355 // Remove all gallery watchers. |
364 ExecuteCmdAndCheckReply(kRemoveAllGalleryWatchCmd, kRemoveAllGalleryWatchOK); | 356 ExecuteCmdAndCheckReply(kRemoveAllGalleryWatchCmd, kRemoveAllGalleryWatchOK); |
365 | 357 |
366 // Gallery watchers removed. chrome.mediaGalleries.getAllGalleryWatch | 358 // Gallery watchers removed. chrome.mediaGalleries.getAllGalleryWatch |
367 // should return an empty list. | 359 // should return an empty list. |
368 ExtensionTestMessageListener final_get_all_check_finished( | 360 ExtensionTestMessageListener final_get_all_check_finished( |
369 kNoGalleryWatchesInstalled, false /* no reply */); | 361 kNoGalleryWatchesInstalled, false /* no reply */); |
370 ExecuteCmdAndCheckReply(kGetAllWatchedGalleryIdsCmd, kGetAllGalleryWatchOK); | 362 ExecuteCmdAndCheckReply(kGetAllWatchedGalleryIdsCmd, kGetAllGalleryWatchOK); |
371 EXPECT_TRUE(final_get_all_check_finished.WaitUntilSatisfied()); | 363 EXPECT_TRUE(final_get_all_check_finished.WaitUntilSatisfied()); |
372 } | 364 } |
OLD | NEW |