OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 # this functional test spawns a web server, and runs chrome to point | 6 # this functional test spawns a web server, and runs chrome to point |
7 # at that web server. The content served contains prefetch requests, | 7 # at that web server. The content served contains prefetch requests, |
8 # and the tests assert that the webserver logs reflect that. | 8 # and the tests assert that the webserver logs reflect that. |
9 | 9 |
10 # run like any functional test: | 10 # run like any functional test: |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 return None | 63 return None |
64 | 64 |
65 # | 65 # |
66 # The next few classes run a simple web server that returns log information | 66 # The next few classes run a simple web server that returns log information |
67 # via a multiprocessing.Queue. | 67 # via a multiprocessing.Queue. |
68 # | 68 # |
69 class AbstractPrefetchServerHandler(BaseHTTPRequestHandler): | 69 class AbstractPrefetchServerHandler(BaseHTTPRequestHandler): |
70 content = { | 70 content = { |
71 "prefetch-origin.html": | 71 "prefetch-origin.html": |
72 (200, """<html><head> | 72 (200, """<html><head> |
73 <link rel="prefetch" href="static-prefetch-target.html"> | 73 <link rel="prerender" href="static-prefetch-target.html"> |
dominich
2011/05/23 21:00:03
Should this should remain as prefetch and should w
gavinp
2011/05/23 21:58:26
Done. Good catch.
Or how about no functional tes
| |
74 <script type="text/javascript"> | 74 <script type="text/javascript"> |
75 function changeParagraph() | 75 function changeParagraph() |
76 { | 76 { |
77 var newPara = document.createElement("p"); | 77 var newPara = document.createElement("p"); |
78 newPara.innerHTML = | 78 newPara.innerHTML = |
79 "<link rel=\\"prefetch\\" href=\\"dynamic-prefetch-target.html\\">" + | 79 "<link rel=\\"prefetch\\" href=\\"dynamic-prefetch-target.html\\">" + |
80 "<p>This paragraph contains a dynamic link prefetch. " + | 80 "<p>This paragraph contains a dynamic link prefetch. " + |
81 "The target of this prefetch is " + | 81 "The target of this prefetch is " + |
82 "<a href=\\"dynamic-prefetch-target.html\\">this document.</a>"; | 82 "<a href=\\"dynamic-prefetch-target.html\\">this document.</a>"; |
83 var para = document.getElementById("p1"); | 83 var para = document.getElementById("p1"); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
129 self.assertEqual(True, server_log.isRetrieved( | 129 self.assertEqual(True, server_log.isRetrieved( |
130 "static-prefetch-target.html")) | 130 "static-prefetch-target.html")) |
131 self.assertEqual(True, server_log.isRetrieved( | 131 self.assertEqual(True, server_log.isRetrieved( |
132 "dynamic-prefetch-target.html")) | 132 "dynamic-prefetch-target.html")) |
133 | 133 |
134 if __name__ == '__main__': | 134 if __name__ == '__main__': |
135 web_server = multiprocessing.Process(target=run_web_server,args=(queue,)) | 135 web_server = multiprocessing.Process(target=run_web_server,args=(queue,)) |
136 web_server.daemon = True | 136 web_server.daemon = True |
137 web_server.start() | 137 web_server.start() |
138 pyauto_functional.Main() | 138 pyauto_functional.Main() |
OLD | NEW |