Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: chrome/browser/extensions/api/media_galleries_private/media_galleries_watch_apitest.cc

Issue 23727009: Cleanup: Remove chrome namespace for storage monitor and media galleries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nit Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 // MediaGalleriesPrivate 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/path_service.h" 9 #include "base/path_service.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesPrivateGalleryWatchApiTest); 118 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesPrivateGalleryWatchApiTest);
119 }; 119 };
120 120
121 121
122 /////////////////////////////////////////////////////////////////////////////// 122 ///////////////////////////////////////////////////////////////////////////////
123 // TESTS // 123 // TESTS //
124 /////////////////////////////////////////////////////////////////////////////// 124 ///////////////////////////////////////////////////////////////////////////////
125 #if defined(OS_WIN) 125 #if defined(OS_WIN)
126 IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest, 126 IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest,
127 BasicGalleryWatch) { 127 BasicGalleryWatch) {
128 chrome::EnsureMediaDirectoriesExists media_directories; 128 EnsureMediaDirectoriesExists media_directories;
129 content::RenderViewHost* host = GetBackgroundHostForTestExtension(); 129 content::RenderViewHost* host = GetBackgroundHostForTestExtension();
130 ASSERT_TRUE(host); 130 ASSERT_TRUE(host);
131 131
132 // Get media file systems. 132 // Get media file systems.
133 ExtensionTestMessageListener get_media_systems_finished( 133 ExtensionTestMessageListener get_media_systems_finished(
134 kGetMediaFileSystemsCallbackOK, false /* no reply */); 134 kGetMediaFileSystemsCallbackOK, false /* no reply */);
135 ExecuteCmdAndCheckReply(host, kGetMediaFileSystemsCmd, 135 ExecuteCmdAndCheckReply(host, kGetMediaFileSystemsCmd,
136 kGetMediaFileSystemsOK); 136 kGetMediaFileSystemsOK);
137 EXPECT_TRUE(get_media_systems_finished.WaitUntilSatisfied()); 137 EXPECT_TRUE(get_media_systems_finished.WaitUntilSatisfied());
138 138
(...skipping 27 matching lines...) Expand all
166 // Remove gallery watch listener. 166 // Remove gallery watch listener.
167 ExecuteCmdAndCheckReply(host, kRemoveGalleryChangedListenerCmd, 167 ExecuteCmdAndCheckReply(host, kRemoveGalleryChangedListenerCmd,
168 kRemoveGalleryChangedListenerOK); 168 kRemoveGalleryChangedListenerOK);
169 169
170 // Remove gallery watch request. 170 // Remove gallery watch request.
171 ExecuteCmdAndCheckReply(host, kRemoveGalleryWatchCmd, kRemoveGalleryWatchOK); 171 ExecuteCmdAndCheckReply(host, kRemoveGalleryWatchCmd, kRemoveGalleryWatchOK);
172 } 172 }
173 173
174 IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest, 174 IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest,
175 RemoveListenerAndModifyGallery) { 175 RemoveListenerAndModifyGallery) {
176 chrome::EnsureMediaDirectoriesExists media_directories; 176 EnsureMediaDirectoriesExists media_directories;
177 content::RenderViewHost* host = GetBackgroundHostForTestExtension(); 177 content::RenderViewHost* host = GetBackgroundHostForTestExtension();
178 ASSERT_TRUE(host); 178 ASSERT_TRUE(host);
179 179
180 // Get media file systems. 180 // Get media file systems.
181 ExtensionTestMessageListener get_media_systems_finished( 181 ExtensionTestMessageListener get_media_systems_finished(
182 kGetMediaFileSystemsCallbackOK, false /* no reply */); 182 kGetMediaFileSystemsCallbackOK, false /* no reply */);
183 ExecuteCmdAndCheckReply(host, kGetMediaFileSystemsCmd, 183 ExecuteCmdAndCheckReply(host, kGetMediaFileSystemsCmd,
184 kGetMediaFileSystemsOK); 184 kGetMediaFileSystemsOK);
185 EXPECT_TRUE(get_media_systems_finished.WaitUntilSatisfied()); 185 EXPECT_TRUE(get_media_systems_finished.WaitUntilSatisfied());
186 186
(...skipping 19 matching lines...) Expand all
206 206
207 // No listener, modify gallery contents. 207 // No listener, modify gallery contents.
208 ASSERT_TRUE(AddNewFileInGallery(chrome::DIR_USER_MUSIC)); 208 ASSERT_TRUE(AddNewFileInGallery(chrome::DIR_USER_MUSIC));
209 209
210 // Remove gallery watch. 210 // Remove gallery watch.
211 ExecuteCmdAndCheckReply(host, kRemoveGalleryWatchCmd, kRemoveGalleryWatchOK); 211 ExecuteCmdAndCheckReply(host, kRemoveGalleryWatchCmd, kRemoveGalleryWatchOK);
212 } 212 }
213 213
214 IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest, 214 IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest,
215 SetupGalleryWatchWithoutListeners) { 215 SetupGalleryWatchWithoutListeners) {
216 chrome::EnsureMediaDirectoriesExists media_directories; 216 EnsureMediaDirectoriesExists media_directories;
217 content::RenderViewHost* host = GetBackgroundHostForTestExtension(); 217 content::RenderViewHost* host = GetBackgroundHostForTestExtension();
218 ASSERT_TRUE(host); 218 ASSERT_TRUE(host);
219 219
220 // Get media file systems. 220 // Get media file systems.
221 ExtensionTestMessageListener get_media_systems_finished( 221 ExtensionTestMessageListener get_media_systems_finished(
222 kGetMediaFileSystemsCallbackOK, false /* no reply */); 222 kGetMediaFileSystemsCallbackOK, false /* no reply */);
223 ExecuteCmdAndCheckReply(host, kGetMediaFileSystemsCmd, 223 ExecuteCmdAndCheckReply(host, kGetMediaFileSystemsCmd,
224 kGetMediaFileSystemsOK); 224 kGetMediaFileSystemsOK);
225 EXPECT_TRUE(get_media_systems_finished.WaitUntilSatisfied()); 225 EXPECT_TRUE(get_media_systems_finished.WaitUntilSatisfied());
226 226
227 // Set up gallery watch. 227 // Set up gallery watch.
228 ExecuteCmdAndCheckReply(host, kSetupWatchOnValidGalleriesCmd, 228 ExecuteCmdAndCheckReply(host, kSetupWatchOnValidGalleriesCmd,
229 kAddGalleryWatchOK); 229 kAddGalleryWatchOK);
230 230
231 // No listeners, modify gallery contents. 231 // No listeners, modify gallery contents.
232 ExtensionTestMessageListener music_gallery_change_event_received( 232 ExtensionTestMessageListener music_gallery_change_event_received(
233 kGalleryChangedEventReceived, false /* no reply */); 233 kGalleryChangedEventReceived, false /* no reply */);
234 ASSERT_TRUE(AddNewFileInGallery(chrome::DIR_USER_MUSIC)); 234 ASSERT_TRUE(AddNewFileInGallery(chrome::DIR_USER_MUSIC));
235 235
236 // Remove gallery watch. 236 // Remove gallery watch.
237 ExecuteCmdAndCheckReply(host, kRemoveGalleryWatchCmd, kRemoveGalleryWatchOK); 237 ExecuteCmdAndCheckReply(host, kRemoveGalleryWatchCmd, kRemoveGalleryWatchOK);
238 } 238 }
239 239
240 IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest, 240 IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest,
241 SetupGalleryChangedListenerWithoutWatchers) { 241 SetupGalleryChangedListenerWithoutWatchers) {
242 chrome::EnsureMediaDirectoriesExists media_directories; 242 EnsureMediaDirectoriesExists media_directories;
243 content::RenderViewHost* host = GetBackgroundHostForTestExtension(); 243 content::RenderViewHost* host = GetBackgroundHostForTestExtension();
244 ASSERT_TRUE(host); 244 ASSERT_TRUE(host);
245 245
246 // Get media file systems. 246 // Get media file systems.
247 ExtensionTestMessageListener get_media_systems_finished( 247 ExtensionTestMessageListener get_media_systems_finished(
248 kGetMediaFileSystemsCallbackOK, false /* no reply */); 248 kGetMediaFileSystemsCallbackOK, false /* no reply */);
249 ExecuteCmdAndCheckReply(host, kGetMediaFileSystemsCmd, 249 ExecuteCmdAndCheckReply(host, kGetMediaFileSystemsCmd,
250 kGetMediaFileSystemsOK); 250 kGetMediaFileSystemsOK);
251 EXPECT_TRUE(get_media_systems_finished.WaitUntilSatisfied()); 251 EXPECT_TRUE(get_media_systems_finished.WaitUntilSatisfied());
252 252
(...skipping 20 matching lines...) Expand all
273 // Set up a invalid gallery watch. 273 // Set up a invalid gallery watch.
274 ExtensionTestMessageListener invalid_gallery_watch_request_finished( 274 ExtensionTestMessageListener invalid_gallery_watch_request_finished(
275 kAddGalleryWatchRequestFailed, false /* no reply */); 275 kAddGalleryWatchRequestFailed, false /* no reply */);
276 ExecuteCmdAndCheckReply(host, kSetupWatchOnInvalidGalleryCmd, 276 ExecuteCmdAndCheckReply(host, kSetupWatchOnInvalidGalleryCmd,
277 kAddGalleryWatchOK); 277 kAddGalleryWatchOK);
278 EXPECT_TRUE(invalid_gallery_watch_request_finished.WaitUntilSatisfied()); 278 EXPECT_TRUE(invalid_gallery_watch_request_finished.WaitUntilSatisfied());
279 } 279 }
280 280
281 IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest, 281 IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest,
282 GetAllGalleryWatch) { 282 GetAllGalleryWatch) {
283 chrome::EnsureMediaDirectoriesExists media_directories; 283 EnsureMediaDirectoriesExists media_directories;
284 content::RenderViewHost* host = GetBackgroundHostForTestExtension(); 284 content::RenderViewHost* host = GetBackgroundHostForTestExtension();
285 ASSERT_TRUE(host); 285 ASSERT_TRUE(host);
286 286
287 // Get media file systems. 287 // Get media file systems.
288 ExtensionTestMessageListener get_media_systems_finished( 288 ExtensionTestMessageListener get_media_systems_finished(
289 kGetMediaFileSystemsCallbackOK, false /* no reply */); 289 kGetMediaFileSystemsCallbackOK, false /* no reply */);
290 ExecuteCmdAndCheckReply(host, kGetMediaFileSystemsCmd, 290 ExecuteCmdAndCheckReply(host, kGetMediaFileSystemsCmd,
291 kGetMediaFileSystemsOK); 291 kGetMediaFileSystemsOK);
292 EXPECT_TRUE(get_media_systems_finished.WaitUntilSatisfied()); 292 EXPECT_TRUE(get_media_systems_finished.WaitUntilSatisfied());
293 293
(...skipping 29 matching lines...) Expand all
323 // list. 323 // list.
324 ExtensionTestMessageListener final_get_all_check_finished( 324 ExtensionTestMessageListener final_get_all_check_finished(
325 kGetAllGalleryWatchResultA, false /* no reply */); 325 kGetAllGalleryWatchResultA, false /* no reply */);
326 ExecuteCmdAndCheckReply(host, kGetAllWatchedGalleryIdsCmd, 326 ExecuteCmdAndCheckReply(host, kGetAllWatchedGalleryIdsCmd,
327 kGetAllGalleryWatchOK); 327 kGetAllGalleryWatchOK);
328 EXPECT_TRUE(final_get_all_check_finished.WaitUntilSatisfied()); 328 EXPECT_TRUE(final_get_all_check_finished.WaitUntilSatisfied());
329 } 329 }
330 330
331 IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest, 331 IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest,
332 RemoveAllGalleryWatch) { 332 RemoveAllGalleryWatch) {
333 chrome::EnsureMediaDirectoriesExists media_directories; 333 EnsureMediaDirectoriesExists media_directories;
334 content::RenderViewHost* host = GetBackgroundHostForTestExtension(); 334 content::RenderViewHost* host = GetBackgroundHostForTestExtension();
335 ASSERT_TRUE(host); 335 ASSERT_TRUE(host);
336 336
337 // Get media file systems. 337 // Get media file systems.
338 ExtensionTestMessageListener get_media_systems_finished( 338 ExtensionTestMessageListener get_media_systems_finished(
339 kGetMediaFileSystemsCallbackOK, false /* no reply */); 339 kGetMediaFileSystemsCallbackOK, false /* no reply */);
340 ExecuteCmdAndCheckReply(host, kGetMediaFileSystemsCmd, 340 ExecuteCmdAndCheckReply(host, kGetMediaFileSystemsCmd,
341 kGetMediaFileSystemsOK); 341 kGetMediaFileSystemsOK);
342 EXPECT_TRUE(get_media_systems_finished.WaitUntilSatisfied()); 342 EXPECT_TRUE(get_media_systems_finished.WaitUntilSatisfied());
343 343
(...skipping 24 matching lines...) Expand all
368 kGetAllGalleryWatchOK); 368 kGetAllGalleryWatchOK);
369 EXPECT_TRUE(final_get_all_check_finished.WaitUntilSatisfied()); 369 EXPECT_TRUE(final_get_all_check_finished.WaitUntilSatisfied());
370 } 370 }
371 #endif 371 #endif
372 372
373 #if !defined(OS_WIN) && !defined(OS_CHROMEOS) 373 #if !defined(OS_WIN) && !defined(OS_CHROMEOS)
374 // Gallery watch request is not enabled on non-windows platforms. 374 // Gallery watch request is not enabled on non-windows platforms.
375 // Please refer to crbug.com/144491. 375 // Please refer to crbug.com/144491.
376 IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest, 376 IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest,
377 SetupGalleryWatch) { 377 SetupGalleryWatch) {
378 chrome::EnsureMediaDirectoriesExists media_directories; 378 EnsureMediaDirectoriesExists media_directories;
379 content::RenderViewHost* host = GetBackgroundHostForTestExtension(); 379 content::RenderViewHost* host = GetBackgroundHostForTestExtension();
380 ASSERT_TRUE(host); 380 ASSERT_TRUE(host);
381 381
382 // Get media file systems. 382 // Get media file systems.
383 ExtensionTestMessageListener get_media_systems_finished( 383 ExtensionTestMessageListener get_media_systems_finished(
384 kGetMediaFileSystemsCallbackOK, false /* no reply */); 384 kGetMediaFileSystemsCallbackOK, false /* no reply */);
385 ExecuteCmdAndCheckReply(host, kGetMediaFileSystemsCmd, 385 ExecuteCmdAndCheckReply(host, kGetMediaFileSystemsCmd,
386 kGetMediaFileSystemsOK); 386 kGetMediaFileSystemsOK);
387 EXPECT_TRUE(get_media_systems_finished.WaitUntilSatisfied()); 387 EXPECT_TRUE(get_media_systems_finished.WaitUntilSatisfied());
388 388
389 // Set up a invalid gallery watch. 389 // Set up a invalid gallery watch.
390 ExtensionTestMessageListener gallery_watch_request_finished( 390 ExtensionTestMessageListener gallery_watch_request_finished(
391 kAddGalleryWatchRequestFailed, false /* no reply */); 391 kAddGalleryWatchRequestFailed, false /* no reply */);
392 // Set up gallery watch. 392 // Set up gallery watch.
393 ExecuteCmdAndCheckReply(host, kSetupWatchOnValidGalleriesCmd, 393 ExecuteCmdAndCheckReply(host, kSetupWatchOnValidGalleriesCmd,
394 kAddGalleryWatchOK); 394 kAddGalleryWatchOK);
395 EXPECT_TRUE(gallery_watch_request_finished.WaitUntilSatisfied()); 395 EXPECT_TRUE(gallery_watch_request_finished.WaitUntilSatisfied());
396 } 396 }
397 397
398 // Gallery watch request is not enabled on non-windows platforms. 398 // Gallery watch request is not enabled on non-windows platforms.
399 // Please refer to crbug.com/144491. 399 // Please refer to crbug.com/144491.
400 IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest, 400 IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateGalleryWatchApiTest,
401 GetAllGalleryWatch) { 401 GetAllGalleryWatch) {
402 chrome::EnsureMediaDirectoriesExists media_directories; 402 EnsureMediaDirectoriesExists media_directories;
403 content::RenderViewHost* host = GetBackgroundHostForTestExtension(); 403 content::RenderViewHost* host = GetBackgroundHostForTestExtension();
404 ASSERT_TRUE(host); 404 ASSERT_TRUE(host);
405 405
406 // Get media file systems. 406 // Get media file systems.
407 ExtensionTestMessageListener get_media_systems_finished( 407 ExtensionTestMessageListener get_media_systems_finished(
408 kGetMediaFileSystemsCallbackOK, false /* no reply */); 408 kGetMediaFileSystemsCallbackOK, false /* no reply */);
409 ExecuteCmdAndCheckReply(host, kGetMediaFileSystemsCmd, 409 ExecuteCmdAndCheckReply(host, kGetMediaFileSystemsCmd,
410 kGetMediaFileSystemsOK); 410 kGetMediaFileSystemsOK);
411 EXPECT_TRUE(get_media_systems_finished.WaitUntilSatisfied()); 411 EXPECT_TRUE(get_media_systems_finished.WaitUntilSatisfied());
412 412
413 // Set up gallery watch. 413 // Set up gallery watch.
414 ExecuteCmdAndCheckReply(host, kSetupWatchOnValidGalleriesCmd, 414 ExecuteCmdAndCheckReply(host, kSetupWatchOnValidGalleriesCmd,
415 kAddGalleryWatchOK); 415 kAddGalleryWatchOK);
416 416
417 // Gallery watchers does not exists. 417 // Gallery watchers does not exists.
418 // chrome.mediaGalleriesPrivate.getAllGalleryWatch should return an empty 418 // chrome.mediaGalleriesPrivate.getAllGalleryWatch should return an empty
419 // list. 419 // list.
420 ExtensionTestMessageListener get_all_gallery_watch_finished( 420 ExtensionTestMessageListener get_all_gallery_watch_finished(
421 kGetAllGalleryWatchResultA, false /* no reply */); 421 kGetAllGalleryWatchResultA, false /* no reply */);
422 ExecuteCmdAndCheckReply(host, kGetAllWatchedGalleryIdsCmd, 422 ExecuteCmdAndCheckReply(host, kGetAllWatchedGalleryIdsCmd,
423 kGetAllGalleryWatchOK); 423 kGetAllGalleryWatchOK);
424 EXPECT_TRUE(get_all_gallery_watch_finished.WaitUntilSatisfied()); 424 EXPECT_TRUE(get_all_gallery_watch_finished.WaitUntilSatisfied());
425 } 425 }
426 #endif 426 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698