-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Fix #916: support pac_url and auto proxy detection"
This reverts commit 206df0d.
- Loading branch information
Showing
7 changed files
with
26 additions
and
117 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
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,46 +1,20 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<title>App.getProxyForURL</title> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<title>App.getProxyForURL</title> | ||
</head> | ||
<body> | ||
<button id="pac" onclick="requestPac()">Request pac</button> | ||
<script> | ||
nw.App.setProxyConfig('dummy:8080'); | ||
var proxy = nw.App.getProxyForURL('http://www.example.com/'); | ||
var expect = 'PROXY dummy:8080'; | ||
if (proxy === expect) { | ||
document.write('<h1 id="result">success</h1>'); | ||
} else { | ||
document.write('<h1 id="result">failure: expect "' + expect + '" but get ' + proxy +'</h1>'); | ||
} | ||
|
||
// Reset Proxy | ||
nw.App.setProxyConfig("", "<direct>"); | ||
|
||
function requestPac() { | ||
nw.App.setProxyConfig('dummy:8080', `http://localhost:${nw.App.manifest.port}/`); | ||
|
||
setTimeout(function() { | ||
var proxy = nw.App.getProxyForURL('http://www.port3128.com/'); | ||
var expect = 'PROXY localhost:3128'; | ||
if (proxy === expect) { | ||
document.write('<h1 id="result2">success</h1>'); | ||
} else { | ||
document.write('<h1 id="result2">failure: expect "' + expect + '" but get ' + proxy +'</h1>'); | ||
} | ||
var proxy = nw.App.getProxyForURL('http://www.port4040.com/'); | ||
var expect = 'PROXY localhost:4040'; | ||
if (proxy === expect) { | ||
document.write('<h1 id="result3">success</h1>'); | ||
} else { | ||
document.write('<h1 id="result3">failure: expect "' + expect + '" but get ' + proxy +'</h1>'); | ||
} | ||
}, 100); | ||
} | ||
|
||
</script> | ||
<script> | ||
nw.App.setProxyConfig('dummy:8080'); | ||
var proxy = nw.App.getProxyForURL('http://www.example.com/'); | ||
var expect = 'PROXY dummy:8080'; | ||
if (proxy === expect) { | ||
document.write('<h1 id="result">success</h1>'); | ||
} else { | ||
document.write('<h1 id="result">failure: expect "' + expect + '" but get ' + proxy +'</h1>'); | ||
} | ||
</script> | ||
</body> | ||
</html> | ||
</html> |
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,4 @@ | ||
{ | ||
"name": "app-getproxyforurl", | ||
"main": "index.html" | ||
} |
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 |
---|---|---|
@@ -1,50 +1,17 @@ | ||
import time | ||
import os | ||
import sys | ||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | ||
from nw_util import * | ||
|
||
from selenium import webdriver | ||
from selenium.webdriver.chrome.options import Options | ||
from selenium.webdriver.common import utils | ||
|
||
test_dir = os.path.dirname(os.path.abspath(__file__)) | ||
chrome_options = Options() | ||
chrome_options.add_argument("nwapp=" + test_dir) | ||
|
||
port = str(utils.free_port()) | ||
|
||
pkgjson = ''' | ||
{ | ||
"name": "app-getproxyforurl", | ||
"main": "index.html", | ||
"bg-script": "bg.js", | ||
"port": "%s" | ||
} | ||
''' % port | ||
|
||
with open(os.path.join(test_dir, 'package.json'), 'w') as bg: | ||
bg.write(pkgjson) | ||
chrome_options.add_argument("nwapp=" + os.path.dirname(os.path.abspath(__file__))) | ||
|
||
driver = webdriver.Chrome(executable_path=os.environ['CHROMEDRIVER'], chrome_options=chrome_options) | ||
driver.implicitly_wait(2) | ||
time.sleep(1) | ||
try: | ||
print driver.current_url | ||
|
||
time.sleep(1) | ||
result = driver.find_element_by_id('result') | ||
print result.get_attribute('innerHTML') | ||
assert("success" in result.get_attribute('innerHTML')) | ||
|
||
wait_window_handles(driver, 1) | ||
switch_to_app(driver) | ||
driver.find_element_by_id('pac').click() | ||
wait_window_handles(driver, 1) | ||
result2 = driver.find_element_by_id('result2') | ||
assert("success" in result2.get_attribute('innerHTML')) | ||
wait_window_handles(driver, 1) | ||
result3 = driver.find_element_by_id('result3') | ||
assert("success" in result3.get_attribute('innerHTML')) | ||
finally: | ||
driver.quit() |