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

Side by Side Diff: tools/chrome_proxy/webdriver/simple_smoke.py

Issue 2559113005: Use python's unittest framework. (Closed)
Patch Set: Remove unused import Created 4 years 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 unified diff | Download patch
« no previous file with comments | « tools/chrome_proxy/webdriver/common.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import sys
5 import time 6 import time
7 import unittest
6 8
7 from common import IntegrationTest 9 import common
8 from common import TestDriver 10 from common import TestDriver
9 11
10 12
11 class SimpleSmoke(IntegrationTest): 13 class SimpleSmoke(unittest.TestCase):
12 14
13 # Simple example integration test. 15 # Simple example integration test.
14 def TestCheckPageWithProxy(self): 16 def testCheckPageWithProxy(self):
15 with TestDriver() as t: 17 with TestDriver() as t:
16 t.AddChromeArg('--enable-spdy-proxy-auth') 18 t.AddChromeArg('--enable-spdy-proxy-auth')
17 t.SetURL('http://check.googlezip.net/test.html') 19 t.SetURL('http://check.googlezip.net/test.html')
18 t.LoadPage() 20 t.LoadPage()
19 print 'Document Title: ', t.ExecuteJavascriptStatement('document.title', 21 print 'Document Title: ', t.ExecuteJavascriptStatement('document.title',
20 timeout=1) 22 timeout=1)
21 time.sleep(5) 23 time.sleep(5)
22 responses = t.GetHTTPResponses() 24 responses = t.GetHTTPResponses()
23 for response in responses: 25 for response in responses:
24 print "URL: %s, ViaHeader: %s, XHR: %s" % (response.url, 26 print "URL: %s, ViaHeader: %s, XHR: %s" % (response.url,
25 response.ResponseHasViaHeader(), response.WasXHR()) 27 response.ResponseHasViaHeader(), response.WasXHR())
26 28
27 # Show how to get a histogram. 29 # Show how to get a histogram.
28 def TestPingbackHistogram(self): 30 def testPingbackHistogram(self):
29 with TestDriver() as t: 31 with TestDriver() as t:
30 t.AddChromeArg('--enable-spdy-proxy-auth') 32 t.AddChromeArg('--enable-spdy-proxy-auth')
31 t.SetURL('http://check.googlezip.net/test.html') 33 t.SetURL('http://check.googlezip.net/test.html')
32 t.LoadPage() 34 t.LoadPage()
33 t.LoadPage() 35 t.LoadPage()
34 print t.GetHistogram('DataReductionProxy.Pingback.Attempted') 36 print t.GetHistogram('DataReductionProxy.Pingback.Attempted')
35 37
36 if __name__ == '__main__': 38 if __name__ == '__main__':
37 test = SimpleSmoke() 39 # Give a different argv so that unittest won't get in the way of our argparse.
sclittle 2016/12/08 23:14:00 nit: pardon my ignorance, but I don't know what th
robertogden 2016/12/08 23:19:30 How's that?
38 test.RunAllTests() 40 unittest.main(argv=[sys.argv[0]], verbosity=2)
OLDNEW
« no previous file with comments | « tools/chrome_proxy/webdriver/common.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698