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

Side by Side Diff: chrome/test/data/extensions/api_test/media_galleries_private/gallerywatch/test.js

Issue 11535008: Implement mediaGalleriesPrivate api to notify extensions about gallery changed events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disable SetupGalleryWatch browser test on ChromeOS Created 7 years, 11 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
« no previous file with comments | « chrome/test/data/extensions/api_test/media_galleries_private/gallerywatch/manifest.json ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 var galleries;
6 var invalidGalleryId = 11000;
7
8 // chrome.mediaGalleries.getMediaFileSystems callback.
9 var mediaFileSystemsListCallback = function (results) {
10 galleries = results;
11 chrome.test.sendMessage('get_media_file_systems_callback_ok');
12 };
13
14 // Gallery changed event handler.
15 var onGalleryChangedCallback = function (details) {
16 chrome.test.sendMessage('gallery_changed_event_received');
17 };
18
19 // Add watch request callback.
20 var onAddWatchRequestCallback = function (details) {
21 if (!details || !details.success)
22 chrome.test.sendMessage('add_watch_request_failed');
23 else
24 chrome.test.sendMessage('add_watch_request_succeeded');
25 };
26
27 // Helpers to add and remove event listeners.
28 function addGalleryChangedListener() {
29 chrome.mediaGalleriesPrivate.onGalleryChanged.addListener(
30 onGalleryChangedCallback);
31 chrome.test.sendMessage('add_gallery_changed_listener_ok');
32 };
33
34 function setupWatchOnValidGalleries() {
35 for (var i = 0; i < galleries.length; ++i) {
36 var info = JSON.parse(galleries[i].name);
37 chrome.mediaGalleriesPrivate.addGalleryWatch(info.galleryId,
38 onAddWatchRequestCallback);
39 }
40 chrome.test.sendMessage('add_gallery_watch_ok');
41 };
42
43 function setupWatchOnInvalidGallery() {
44 chrome.mediaGalleriesPrivate.addGalleryWatch(invalidGalleryId,
45 onAddWatchRequestCallback);
46 chrome.test.sendMessage('add_gallery_watch_ok');
47 }
48
49 function getMediaFileSystems() {
50 chrome.mediaGalleries.getMediaFileSystems(mediaFileSystemsListCallback);
51 chrome.test.sendMessage('get_media_file_systems_ok');
52 };
53
54 function removeGalleryWatch() {
55 for (var i = 0; i < galleries.length; ++i) {
56 var info = JSON.parse(galleries[i].name);
57 chrome.mediaGalleriesPrivate.removeGalleryWatch(info.galleryId);
58 }
59 chrome.test.sendMessage('remove_gallery_watch_ok');
60 };
61
62 function removeGalleryChangedListener() {
63 chrome.mediaGalleriesPrivate.onGalleryChanged.removeListener(
64 onGalleryChangedCallback);
65 chrome.test.sendMessage('remove_gallery_changed_listener_ok');
66 };
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/media_galleries_private/gallerywatch/manifest.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698