Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LavrovArtem committed May 17, 2018
1 parent fe3c7de commit 9693b4c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 28 deletions.
54 changes: 28 additions & 26 deletions test/client/fixtures/utils/url-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,6 @@ test('destination with host only', function () {
strictEqual(proxyUrl, 'http://' + PROXY_HOST + '/sessionId/' + destUrl);
});

test('destination with host only (https proxy)', function () {
var destUrl = 'http://test.example.com/';
var proxyUrl = getProxyUrl(destUrl, '', 'https:');

strictEqual(proxyUrl, 'https://' + PROXY_HOST + '/sessionId/' + destUrl);
});

test('destination with https protocol', function () {
var destUrl = 'https://test.example.com:53/';
var proxyUrl = getProxyUrl(destUrl);
Expand All @@ -216,12 +209,6 @@ test('relative path', function () {
strictEqual(parsedUrl.partAfterHost, 'share?id=1kjQMWh7IcHdTBbTv6otRvCGYr-p02q206M7aR7dmog0');
});

test('relative path (https proxy)', function () {
var proxyUrl = getProxyUrl('/Image1.jpg', '', 'https:');

strictEqual(proxyUrl, 'https://' + PROXY_HOST + '/sessionId/https://example.com/Image1.jpg');
});

if (window.navigator.platform.toLowerCase() === 'win32' && !browserUtils.isFirefox) {
test('relative file path', function () {
var destUrl = 'C:\\index.htm';
Expand Down Expand Up @@ -292,14 +279,6 @@ test('special pages (GH-339)', function () {
});
});

test('special pages (GH-339) (https proxy)', function () {
sharedUrlUtils.SPECIAL_PAGES.forEach(function (url) {
var proxyUrl = getProxyUrl(url, '', 'https:');

strictEqual(proxyUrl, 'https://' + PROXY_HOST + '/sessionId/' + url);
});
});

test('convert a charset to lower case (GH-752)', function () {
var url = 'http://example.com';
var opts = {
Expand All @@ -312,10 +291,31 @@ test('convert a charset to lower case (GH-752)', function () {
strictEqual(sharedUrlUtils.getProxyUrl(url, opts), 'http://localhost:5555/sessionId!utf-8/' + url);
});

module('parse proxy url');
module('https proxy protocol');

test('http', function () {
var proxyUrl = 'http://' + PROXY_HOST + '/sessionId/http://test.example.com:53/PA/TH/?#testHash';
test('destination with host only', function () {
var destUrl = 'http://test.example.com/';
var proxyUrl = getProxyUrl(destUrl, '', 'https:');

strictEqual(proxyUrl, 'https://' + PROXY_HOST + '/sessionId/' + destUrl);
});

test('relative path', function () {
var proxyUrl = getProxyUrl('/Image1.jpg', '', 'https:');

strictEqual(proxyUrl, 'https://' + PROXY_HOST + '/sessionId/https://example.com/Image1.jpg');
});

test('special pages', function () {
sharedUrlUtils.SPECIAL_PAGES.forEach(function (url) {
var proxyUrl = getProxyUrl(url, '', 'https:');

strictEqual(proxyUrl, 'https://' + PROXY_HOST + '/sessionId/' + url);
});
});

test('parse proxy url', function () {
var proxyUrl = 'https://' + PROXY_HOST + '/sessionId/http://test.example.com:53/PA/TH/?#testHash';
var parsingResult = urlUtils.parseProxyUrl(proxyUrl);

strictEqual(parsingResult.destUrl, 'http://test.example.com:53/PA/TH/?#testHash');
Expand All @@ -327,8 +327,10 @@ test('http', function () {
strictEqual(parsingResult.sessionId, 'sessionId');
});

test('http (https proxy)', function () {
var proxyUrl = 'https://' + PROXY_HOST + '/sessionId/http://test.example.com:53/PA/TH/?#testHash';
module('parse proxy url');

test('http', function () {
var proxyUrl = 'http://' + PROXY_HOST + '/sessionId/http://test.example.com:53/PA/TH/?#testHash';
var parsingResult = urlUtils.parseProxyUrl(proxyUrl);

strictEqual(parsingResult.destUrl, 'http://test.example.com:53/PA/TH/?#testHash');
Expand Down
4 changes: 2 additions & 2 deletions test/server/data/page/expected-https.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html manifest="https://127.0.0.1:1836/sessionId/http://base.url/some.url" manifest-hammerhead-stored-value="/some.url"><head><meta class="charset-hammerhead-shadow-ui" charset="utf-8"><link rel="stylesheet" type="text/css" class="ui-stylesheet-hammerhead-shadow-ui" href="https://127.0.0.1:1836/styles1.css"><link rel="stylesheet" type="text/css" class="ui-stylesheet-hammerhead-shadow-ui" href="https://127.0.0.1:1836/styles2.css"><script type="text/javascript" class="script-hammerhead-shadow-ui" charset="UTF-8" src="https://127.0.0.1:1836/hammerhead.js"></script><script type="text/javascript" class="script-hammerhead-shadow-ui" charset="UTF-8" src="https://127.0.0.1:1836/script1.js"></script><script type="text/javascript" class="script-hammerhead-shadow-ui" charset="UTF-8" src="https://127.0.0.1:1836/script2.js"></script><script type="text/javascript" class="script-hammerhead-shadow-ui" charset="UTF-8" src="https://127.0.0.1:1836/task.js"></script>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=7">
<link id="stylesheet" rel="stylesheet" type="text/css" href="https://127.0.0.1:1836/sessionId/http://stylesheet.url" crossorigin="anonymous" href-hammerhead-stored-value="http://stylesheet.url">
<script type="text/javascript" src="https://127.0.0.1:1836/sessionId!s!utf-8/http://link.url" crossorigin="anonymous" src-hammerhead-stored-value="http://link.url"></script>
<link id="stylesheet" rel="stylesheet" type="text/css" href="https://127.0.0.1:1836/sessionId/http://stylesheet.url" crossorigin="anonymous" href-hammerhead-stored-value="http://stylesheet.url" integrity-hammerhead-stored-value="sha384-Li9vy3DqF8tnTXuiaAJuML3ky+er10rcgNR/VqsVpcw+ThHmYcwiB1pbOxEbzJr7">
<script type="text/javascript" src="https://127.0.0.1:1836/sessionId!s!utf-8/http://link.url" crossorigin="anonymous" src-hammerhead-stored-value="http://link.url" integrity-hammerhead-stored-value="sha384-Li9vy3DqF8tnTXuiaAJuML3ky+er10rcgNR/VqsVpcw+ThHmYcwiB1pbOxEbzJr7"></script>
<script type="text/javascript" charset="utf-16be" src="https://127.0.0.1:1836/sessionId!s!utf-16be/http://link.url" src-hammerhead-stored-value="http://link.url"></script>
<meta http-equiv="Refresh" content="0;URL=https://127.0.0.1:1836/sessionId/http://link.url/">
<meta>
Expand Down

0 comments on commit 9693b4c

Please sign in to comment.