forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Files.app Test: check the cast icon in drive volume
This patch introduces the mock cast API which provide a dummy cast list and the cast icon is shown on the window. So we can check if the icon is shown correctly. BUG=405415 TEST=manually tested Review URL: https://codereview.chromium.org/505043002 Cr-Commit-Position: refs/heads/master@{#292944}
- Loading branch information
Showing
7 changed files
with
172 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
chrome/test/data/extensions/api_test/file_manager_browsertest/cast_extension_mock/load.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// Copyright 2014 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
'use strict'; | ||
|
||
/** | ||
* @fileOverview This file loads the MOCK cast APIs for test. | ||
*/ | ||
|
||
chrome.cast = {}; | ||
|
||
/** | ||
* @enum {string} | ||
* @const | ||
*/ | ||
chrome.cast.ReceiverAvailability = { | ||
UNAVAILABLE: 'unavailable', | ||
AVAILABLE: 'available', | ||
}; | ||
Object.freeze(chrome.cast.ReceiverAvailability); | ||
|
||
/** | ||
* @constructor | ||
*/ | ||
chrome.cast.SessionRequest = function() { | ||
}; | ||
|
||
/** | ||
* @constructor | ||
* @param {chrome.cast.SessionRequest} sessionRequest | ||
* @param {function(chrome.cast.Session)} onSession | ||
* @param {function(chrome.cast.ReceiverAvailability)} onReceiver | ||
*/ | ||
chrome.cast.ApiConfig = function(sessionRequest, onSession, onReceiver) { | ||
this.onReceiver_ = onReceiver; | ||
|
||
Object.seal(this); | ||
}; | ||
|
||
/** | ||
* @param {chrome.cast.ApiConfig} apiConfig | ||
* @param {function()} onInitSuccess | ||
* @param {function(chrome.cast.Error)} onError | ||
*/ | ||
chrome.cast.initialize = function(apiConfig, onInitSuccess, onError) { | ||
this.apiConfig_ = apiConfig; | ||
|
||
var receiver1 = {friendlyName: 'test cast', label: 'testcast'}; | ||
var receivers = [receiver1]; | ||
setTimeout(this.apiConfig_.onReceiver_.bind( | ||
null, chrome.cast.ReceiverAvailability.UNAVAILABLE, [])); | ||
setTimeout(this.apiConfig_.onReceiver_.bind( | ||
null, chrome.cast.ReceiverAvailability.AVAILABLE, receivers), 1000); | ||
|
||
onInitSuccess(); | ||
}; | ||
|
||
/** | ||
* Initialized apiConfig value. | ||
* @type {chrome.cast.ApiConfig} | ||
* @private | ||
*/ | ||
chrome.cast.apiConfig_ = null; | ||
|
||
/** | ||
* @const | ||
*/ | ||
chrome.cast.isAvailable = true; | ||
|
||
Object.seal(chrome.cast); | ||
|
||
// Invokes the handler. | ||
if (window['__onGCastApiAvailable']) | ||
window['__onGCastApiAvailable'](true, null); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
.../data/extensions/api_test/file_manager_browsertest/video_player/test_helper_on_ui_page.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright 2014 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
'use strict'; | ||
|
||
/** | ||
* Overrides fileBrowserPrivate.getDownloadUrl | ||
* @param {string} url | ||
* @param {function(string)} callback | ||
*/ | ||
chrome.fileBrowserPrivate.getDownloadUrl = function(url, callback) { | ||
var dummyUrl = 'http://example.com/test.mp4?access_token=ACCESSTOKEN; | ||
setTimeout(callback.bind(null, dummyUrl)); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters