Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / test / data / extensions / api_test / file_manager_browsertest / file_manager / open_audio_files.js
index f3b817e..73b6971 100644 (file)
  *     object.
  */
 function getTrackText(audioAppId, query) {
-  var titleElements = callRemoteTestUtil(
+  var titleElements = audioPlayerApp.callRemoteTestUtil(
       'queryAllElements',
       audioAppId,
       [query + ' > .data > .data-title']);
-  var artistElements = callRemoteTestUtil(
+  var artistElements = audioPlayerApp.callRemoteTestUtil(
       'queryAllElements',
       audioAppId,
       [query + ' > .data > .data-artist']);
@@ -59,27 +59,29 @@ function audioOpen(path) {
     },
     function(result) {
       chrome.test.assertTrue(result);
-      waitForFileListChange(appId, expectedFilesBefore.length).then(this.next);
+      remoteCall.waitForFileListChange(appId, expectedFilesBefore.length).
+          then(this.next);
     },
     function(actualFilesAfter) {
       chrome.test.assertEq(expectedFilesAfter, actualFilesAfter);
-      callRemoteTestUtil(
+      remoteCall.callRemoteTestUtil(
           'openFile', appId, ['Beautiful Song.ogg'], this.next);
     },
     // Wait for the audio player window.
     function(result) {
       chrome.test.assertTrue(result);
-      waitForWindow('audio_player.html').then(this.next);
+      audioPlayerApp.waitForWindow('audio_player.html').then(this.next);
     },
     // Wait for the changes of the player status.
     function(inAppId) {
       audioAppId = inAppId;
-      waitForElement(audioAppId, 'audio-player[playing]').then(this.next);
+      audioPlayerApp.waitForElement(audioAppId, 'audio-player[playing]').
+          then(this.next);
     },
     // Get the source file name.
     function(element) {
       chrome.test.assertEq(
-          'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' +
+          'filesystem:chrome-extension://' + AUDIO_PLAYER_APP_ID + '/' +
               'external' + path + '/Beautiful%20Song.ogg',
           element.attributes.currenttrackurl);
       var query1 = 'audio-player /deep/ .track[index="0"][active]';
@@ -101,7 +103,7 @@ function audioOpen(path) {
     },
     // Open another file.
     function() {
-      callRemoteTestUtil(
+      remoteCall.callRemoteTestUtil(
           'openFile', appId, ['newly added file.ogg'], this.next);
     },
     // Wait for the changes of the player status.
@@ -110,12 +112,12 @@ function audioOpen(path) {
       var query = 'audio-player' +
                   '[playing]' +
                   '[currenttrackurl$="newly%20added%20file.ogg"]';
-      waitForElement(audioAppId, query).then(this.next);
+      audioPlayerApp.waitForElement(audioAppId, query).then(this.next);
     },
     // Get the source file name.
     function(element) {
       chrome.test.assertEq(
-          'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' +
+          'filesystem:chrome-extension://' + AUDIO_PLAYER_APP_ID + '/' +
               'external' + path + '/newly%20added%20file.ogg',
           element.attributes.currenttrackurl);
       var query1 = 'audio-player /deep/ .track[index="0"]:not([active])';
@@ -138,7 +140,7 @@ function audioOpen(path) {
     // Wait for the changes of the player status.
     function() {
       // Close window
-      closeWindowAndWait(audioAppId).then(this.next);
+      audioPlayerApp.closeWindowAndWait(audioAppId).then(this.next);
     },
     // Wait for the audio player.
     function(result) {
@@ -176,27 +178,29 @@ function audioAutoAdvance(path) {
     },
     function(result) {
       chrome.test.assertTrue(result);
-      waitForFileListChange(appId, expectedFilesBefore.length).then(this.next);
+      remoteCall.waitForFileListChange(appId, expectedFilesBefore.length).
+          then(this.next);
     },
     function(actualFilesAfter) {
       chrome.test.assertEq(expectedFilesAfter, actualFilesAfter);
-      callRemoteTestUtil(
+      remoteCall.callRemoteTestUtil(
           'openFile', appId, ['Beautiful Song.ogg'], this.next);
     },
     // Wait for the audio player window.
     function(result) {
       chrome.test.assertTrue(result);
-      waitForWindow('audio_player.html').then(this.next);
+      audioPlayerApp.waitForWindow('audio_player.html').then(this.next);
     },
     // Wait for the changes of the player status.
     function(inAppId) {
       audioAppId = inAppId;
-      waitForElement(audioAppId, 'audio-player[playing]').then(this.next);
+      audioPlayerApp.waitForElement(audioAppId, 'audio-player[playing]').
+          then(this.next);
     },
     // Get the source file name.
     function(element) {
       chrome.test.assertEq(
-          'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' +
+          'filesystem:chrome-extension://' + AUDIO_PLAYER_APP_ID + '/' +
               'external' + path + '/Beautiful%20Song.ogg',
           element.attributes.currenttrackurl);
 
@@ -204,17 +208,17 @@ function audioAutoAdvance(path) {
       var query = 'audio-player' +
                   '[playing]' +
                   '[currenttrackurl$="newly%20added%20file.ogg"]';
-      waitForElement(audioAppId, query).then(this.next);
+      audioPlayerApp.waitForElement(audioAppId, query).then(this.next);
     },
     // Get the source file name.
     function(element) {
       chrome.test.assertEq(
-          'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' +
+          'filesystem:chrome-extension://' + AUDIO_PLAYER_APP_ID + '/' +
               'external' + path + '/newly%20added%20file.ogg',
           element.attributes.currenttrackurl);
 
       // Close window
-      closeWindowAndWait(audioAppId).then(this.next);
+      audioPlayerApp.closeWindowAndWait(audioAppId).then(this.next);
     },
     function(result) {
       chrome.test.assertTrue(result);
@@ -240,46 +244,48 @@ function audioRepeatSingleFile(path) {
     function(inAppId) {
       appId = inAppId;
 
-      callRemoteTestUtil(
+      remoteCall.callRemoteTestUtil(
           'openFile', appId, ['Beautiful Song.ogg'], this.next);
     },
     // Wait for the audio player window.
     function(result) {
       chrome.test.assertTrue(result);
-      waitForWindow('audio_player.html').then(this.next);
+      audioPlayerApp.waitForWindow('audio_player.html').then(this.next);
     },
     // Wait for the changes of the player status.
     function(inAppId) {
       audioAppId = inAppId;
-      waitForElement(audioAppId, 'audio-player[playing]').then(this.next);
+      audioPlayerApp.waitForElement(audioAppId, 'audio-player[playing]').
+          then(this.next);
     },
     // Get the source file name.
     function(element) {
       chrome.test.assertEq(
-          'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' +
+          'filesystem:chrome-extension://' + AUDIO_PLAYER_APP_ID + '/' +
               'external' + path + '/Beautiful%20Song.ogg',
           element.attributes.currenttrackurl);
 
-      callRemoteTestUtil('fakeMouseClick',
-                         audioAppId,
-                         ['audio-player /deep/ button.repeat input'],
-                         this.next);
+      audioPlayerApp.callRemoteTestUtil(
+          'fakeMouseClick',
+          audioAppId,
+          ['audio-player /deep/ button.repeat input'],
+          this.next);
     },
     function(result) {
       chrome.test.assertTrue(result, 'Failed to click the repeat button');
 
       var selector = 'audio-player[playing][playcount="1"]';
-      waitForElement(audioAppId, selector).then(this.next);
+      audioPlayerApp.waitForElement(audioAppId, selector).then(this.next);
     },
     // Get the source file name.
     function(element) {
       chrome.test.assertEq(
-          'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' +
+          'filesystem:chrome-extension://' + AUDIO_PLAYER_APP_ID + '/' +
               'external' + path + '/Beautiful%20Song.ogg',
           element.attributes.currenttrackurl);
 
       // Close window
-      closeWindowAndWait(audioAppId).then(this.next);
+      audioPlayerApp.closeWindowAndWait(audioAppId).then(this.next);
     },
     // Wait for the audio player.
     function(result) {
@@ -306,33 +312,34 @@ function audioNoRepeatSingleFile(path) {
     function(inAppId) {
       appId = inAppId;
 
-      callRemoteTestUtil(
+      remoteCall.callRemoteTestUtil(
           'openFile', appId, ['Beautiful Song.ogg'], this.next);
     },
     // Wait for the audio player window.
     function(result) {
       chrome.test.assertTrue(result);
-      waitForWindow('audio_player.html').then(this.next);
+      audioPlayerApp.waitForWindow('audio_player.html').then(this.next);
     },
     // Wait for the changes of the player status.
     function(inAppId) {
       audioAppId = inAppId;
-      waitForElement(audioAppId, 'audio-player[playing]').then(this.next);
+      audioPlayerApp.waitForElement(audioAppId, 'audio-player[playing]').
+          then(this.next);
     },
     // Get the source file name.
     function(element) {
       chrome.test.assertEq(
-          'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' +
+          'filesystem:chrome-extension://' + AUDIO_PLAYER_APP_ID + '/' +
               'external' + path + '/Beautiful%20Song.ogg',
           element.attributes.currenttrackurl);
 
       var selector = 'audio-player[playcount="1"]:not([playing])';
-      waitForElement(audioAppId, selector).then(this.next);
+      audioPlayerApp.waitForElement(audioAppId, selector).then(this.next);
     },
     // Get the source file name.
     function(element) {
       // Close window
-      closeWindowAndWait(audioAppId).then(this.next);
+      audioPlayerApp.closeWindowAndWait(audioAppId).then(this.next);
     },
     // Wait for the audio player.
     function(result) {
@@ -370,33 +377,35 @@ function audioRepeatMultipleFile(path) {
     },
     function(result) {
       chrome.test.assertTrue(result);
-      waitForFiles(appId, expectedFilesAfter).then(this.next);
+      remoteCall.waitForFiles(appId, expectedFilesAfter).then(this.next);
     },
     function(/* no result */) {
-      callRemoteTestUtil(
+      remoteCall.callRemoteTestUtil(
           'openFile', appId, ['newly added file.ogg'], this.next);
     },
     // Wait for the audio player window.
     function(result) {
       chrome.test.assertTrue(result);
-      waitForWindow('audio_player.html').then(this.next);
+      audioPlayerApp.waitForWindow('audio_player.html').then(this.next);
     },
     // Wait for the changes of the player status.
     function(inAppId) {
       audioAppId = inAppId;
-      waitForElement(audioAppId, 'audio-player[playing]').then(this.next);
+      audioPlayerApp.waitForElement(audioAppId, 'audio-player[playing]').
+          then(this.next);
     },
     // Get the source file name.
     function(element) {
       chrome.test.assertEq(
-          'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' +
+          'filesystem:chrome-extension://' + AUDIO_PLAYER_APP_ID + '/' +
               'external' + path + '/newly%20added%20file.ogg',
           element.attributes.currenttrackurl);
 
-      callRemoteTestUtil('fakeMouseClick',
-                         audioAppId,
-                         ['audio-player /deep/ button.repeat input'],
-                         this.next);
+      audioPlayerApp.callRemoteTestUtil(
+          'fakeMouseClick',
+          audioAppId,
+          ['audio-player /deep/ button.repeat input'],
+          this.next);
     },
     function(result) {
       chrome.test.assertTrue(result, 'Failed to click the repeat button');
@@ -405,17 +414,17 @@ function audioRepeatMultipleFile(path) {
       var query = 'audio-player' +
                   '[playing]' +
                   '[currenttrackurl$="Beautiful%20Song.ogg"]';
-      waitForElement(audioAppId, query).then(this.next);
+      audioPlayerApp.waitForElement(audioAppId, query).then(this.next);
     },
     // Get the source file name.
     function(element) {
       chrome.test.assertEq(
-          'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' +
+          'filesystem:chrome-extension://' + AUDIO_PLAYER_APP_ID + '/' +
               'external' + path + '/Beautiful%20Song.ogg',
           element.attributes.currenttrackurl);
 
       // Close window
-      closeWindowAndWait(audioAppId).then(this.next);
+      audioPlayerApp.closeWindowAndWait(audioAppId).then(this.next);
     },
     // Wait for the audio player.
     function(result) {
@@ -453,37 +462,38 @@ function audioNoRepeatMultipleFile(path) {
     },
     function(result) {
       chrome.test.assertTrue(result);
-      waitForFiles(appId, expectedFilesAfter).then(this.next);
+      remoteCall.waitForFiles(appId, expectedFilesAfter).then(this.next);
     },
     function(/* no result */) {
-      callRemoteTestUtil(
+      remoteCall.callRemoteTestUtil(
           'openFile', appId, ['newly added file.ogg'], this.next);
     },
     // Wait for the audio player window.
     function(result) {
       chrome.test.assertTrue(result);
-      waitForWindow('audio_player.html').then(this.next);
+      audioPlayerApp.waitForWindow('audio_player.html').then(this.next);
     },
     // Wait for the changes of the player status.
     function(inAppId) {
       audioAppId = inAppId;
-      waitForElement(audioAppId, 'audio-player[playing]').then(this.next);
+      audioPlayerApp.waitForElement(audioAppId, 'audio-player[playing]').
+          then(this.next);
     },
     // Get the source file name.
     function(element) {
       chrome.test.assertEq(
-          'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' +
+          'filesystem:chrome-extension://' + AUDIO_PLAYER_APP_ID + '/' +
               'external' + path + '/newly%20added%20file.ogg',
           element.attributes.currenttrackurl);
 
       // Wait for next song.
       var query = 'audio-player:not([playing])';
-      waitForElement(audioAppId, query).then(this.next);
+      audioPlayerApp.waitForElement(audioAppId, query).then(this.next);
     },
     // Get the source file name.
     function(element) {
       // Close window
-      closeWindowAndWait(audioAppId).then(this.next);
+      audioPlayerApp.closeWindowAndWait(audioAppId).then(this.next);
     },
     // Wait for the audio player.
     function(result) {