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

Unified Diff: chrome/browser/resources/file_manager/js/share_dialog.js

Issue 22185002: Add browser test to the sharing dialog feature in Files.app. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added the licence header. Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/file_manager/js/share_dialog.js
diff --git a/chrome/browser/resources/file_manager/js/share_dialog.js b/chrome/browser/resources/file_manager/js/share_dialog.js
index 15ba6c8c80f16178662d8a81878982540def4e48..a06a50e86cfaf6fb12799325f062516828403b54 100644
--- a/chrome/browser/resources/file_manager/js/share_dialog.js
+++ b/chrome/browser/resources/file_manager/js/share_dialog.js
@@ -32,12 +32,12 @@ ShareDialog.FAILURE_TIMEOUT = 5000;
/**
* Wraps a Web View element and adds authorization headers to it.
- * @param {origin} origin Origin to be authorized.
+ * @param {string} urlPattern Pattern of urls to be authorized.
* @param {WebView} webView Web View element to be wrapped.
* @constructor
*/
-ShareDialog.WebViewAuthorizer = function(origin, webView) {
- this.origin_ = origin;
+ShareDialog.WebViewAuthorizer = function(urlPattern, webView) {
+ this.urlPattern_ = urlPattern;
this.webView_ = webView;
this.initialized_ = false;
this.accessToken_ = null;
@@ -58,7 +58,7 @@ ShareDialog.WebViewAuthorizer.prototype.initialize = function(callback) {
this.webView_.removeEventListener('loadstop', registerInjectionHooks);
this.webView_.onBeforeSendHeaders.addListener(
this.authorizeRequest_.bind(this),
- {urls: [this.origin_ + '/*']},
+ {urls: [this.urlPattern_]},
['blocking', 'requestHeaders']);
this.initialized_ = true;
callback();
@@ -218,14 +218,14 @@ ShareDialog.prototype.show = function(entry, onFailure) {
this.webViewWrapper_, 'share-dialog-webview', 'webview');
this.webView_.setAttribute('tabIndex', '-1');
this.webViewAuthorizer_ = new ShareDialog.WebViewAuthorizer(
- ShareClient.SHARE_TARGET, this.webView_);
+ !window.IN_TEST ? (ShareClient.SHARE_TARGET + '/*') : '<all_urls>',
+ this.webView_);
this.webView_.addEventListener('newwindow', function(e) {
// Discard the window object and reopen in an external window.
e.window.discard();
chrome.windows.create({url: e.targetUrl});
e.preventDefault();
});
-
cr.ui.dialogs.BaseDialog.prototype.show.call(this, '', null, null, null);
// Initialize and authorize the Web View tag asynchronously.
« no previous file with comments | « chrome/browser/resources/file_manager/js/share_client.js ('k') | chrome/browser/resources/file_manager/js/test_util.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698