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. | |
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, | 195 IN_PROC_BROWSER_TEST_F(MediaGalleriesGalleryWatchApiTest, |
202 MAYBE_BasicGalleryWatch) { | 196 BasicGalleryWatch) { |
Lei Zhang
2014/09/02 18:56:53
fits on prev line
Oren Blasberg
2014/09/02 19:04:11
Done.
| |
203 // Add gallery watch listener. | 197 // Add gallery watch listener. |
204 ExecuteCmdAndCheckReply(kAddGalleryChangedListenerCmd, | 198 ExecuteCmdAndCheckReply(kAddGalleryChangedListenerCmd, |
205 kAddGalleryChangedListenerOK); | 199 kAddGalleryChangedListenerOK); |
206 | 200 |
207 SetupGalleryWatches(); | 201 SetupGalleryWatches(); |
208 | 202 |
209 // Modify gallery contents. | 203 // Modify gallery contents. |
210 ExtensionTestMessageListener gallery_change_event_received( | 204 ExtensionTestMessageListener gallery_change_event_received( |
211 kGalleryChangedEventReceived, false /* no reply */); | 205 kGalleryChangedEventReceived, false /* no reply */); |
212 | 206 |
(...skipping 21 matching lines...) Expand all Loading... | |
234 SetupGalleryWatches(); | 228 SetupGalleryWatches(); |
235 | 229 |
236 | 230 |
237 // Modify gallery contents; expect correct details. | 231 // Modify gallery contents; expect correct details. |
238 ExtensionTestMessageListener got_correct_details( | 232 ExtensionTestMessageListener got_correct_details( |
239 kOnGalleryChangedCheckingOK, false); | 233 kOnGalleryChangedCheckingOK, false); |
240 ASSERT_TRUE(AddNewFileInTestGallery()); | 234 ASSERT_TRUE(AddNewFileInTestGallery()); |
241 EXPECT_TRUE(got_correct_details.WaitUntilSatisfied()); | 235 EXPECT_TRUE(got_correct_details.WaitUntilSatisfied()); |
242 } | 236 } |
243 | 237 |
244 // http://crbug.com/390979 | |
245 IN_PROC_BROWSER_TEST_F(MediaGalleriesGalleryWatchApiTest, | 238 IN_PROC_BROWSER_TEST_F(MediaGalleriesGalleryWatchApiTest, |
246 DISABLED_RemoveListenerAndModifyGallery) { | 239 RemoveListenerAndModifyGallery) { |
247 if (!GalleryWatchesSupported()) | 240 if (!GalleryWatchesSupported()) |
248 return; | 241 return; |
249 | 242 |
250 // Add a gallery watch listener. | 243 // Add a gallery watch listener. |
251 ExecuteCmdAndCheckReply(kAddGalleryChangedListenerCmd, | 244 ExecuteCmdAndCheckReply(kAddGalleryChangedListenerCmd, |
252 kAddGalleryChangedListenerOK); | 245 kAddGalleryChangedListenerOK); |
253 SetupGalleryWatches(); | 246 SetupGalleryWatches(); |
254 | 247 |
255 // Modify gallery contents. | 248 // Modify gallery contents. |
256 ExtensionTestMessageListener gallery_change_event_received( | 249 ExtensionTestMessageListener gallery_change_event_received( |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
363 // Remove all gallery watchers. | 356 // Remove all gallery watchers. |
364 ExecuteCmdAndCheckReply(kRemoveAllGalleryWatchCmd, kRemoveAllGalleryWatchOK); | 357 ExecuteCmdAndCheckReply(kRemoveAllGalleryWatchCmd, kRemoveAllGalleryWatchOK); |
365 | 358 |
366 // Gallery watchers removed. chrome.mediaGalleries.getAllGalleryWatch | 359 // Gallery watchers removed. chrome.mediaGalleries.getAllGalleryWatch |
367 // should return an empty list. | 360 // should return an empty list. |
368 ExtensionTestMessageListener final_get_all_check_finished( | 361 ExtensionTestMessageListener final_get_all_check_finished( |
369 kNoGalleryWatchesInstalled, false /* no reply */); | 362 kNoGalleryWatchesInstalled, false /* no reply */); |
370 ExecuteCmdAndCheckReply(kGetAllWatchedGalleryIdsCmd, kGetAllGalleryWatchOK); | 363 ExecuteCmdAndCheckReply(kGetAllWatchedGalleryIdsCmd, kGetAllGalleryWatchOK); |
371 EXPECT_TRUE(final_get_all_check_finished.WaitUntilSatisfied()); | 364 EXPECT_TRUE(final_get_all_check_finished.WaitUntilSatisfied()); |
372 } | 365 } |
OLD | NEW |