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

Side by Side Diff: app_test.py

Issue 10448057: Add refresh support to the console page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/chromium-build
Patch Set: Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « app.py ('k') | base_page.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 import datetime 6 import datetime
7 import os 7 import os
8 import unittest 8 import unittest
9 9
10 import app 10 import app
11 11
12 12
13 TEST_DIR = os.path.join(os.path.dirname(__file__), 'tests')
14
15
13 class GaeTestCase(unittest.TestCase): 16 class GaeTestCase(unittest.TestCase):
14 def setUp(self, *args, **kwargs): 17 def setUp(self, *args, **kwargs):
15 self.clear_datastore() 18 self.clear_datastore()
16 super(GaeTestCase, self).setUp(*args, **kwargs) 19 super(GaeTestCase, self).setUp(*args, **kwargs)
17 20
21 # R0201: 21,2:GaeTestCase._load_content: Method could be a function
22 # pylint: disable=R0201
23 def _load_content(self, test_dir, path):
24 with open(os.path.join(test_dir, path)) as fh:
25 return fh.read()
26 return None
27
18 @staticmethod 28 @staticmethod
19 def save_page(localpath, content): 29 def save_page(localpath, content):
30 page_data = {}
31 page_data['content'] = content
20 fetch_timestamp = datetime.datetime.now() 32 fetch_timestamp = datetime.datetime.now()
21 model = app.Page(localpath=localpath, content=None, 33 model = app.Page(localpath=localpath, content=None,
22 fetch_timestamp=fetch_timestamp) 34 fetch_timestamp=fetch_timestamp)
23 model.put() 35 model.put()
24 app.save_page(model, localpath=localpath, content=content, 36 app.save_page(model, localpath=localpath, fetch_timestamp=fetch_timestamp,
25 fetch_timestamp=fetch_timestamp) 37 page_data=page_data)
26 return model 38 return model
27 39
28 @staticmethod 40 @staticmethod
29 def clear_datastore(): 41 def clear_datastore():
30 from google.appengine.api import apiproxy_stub_map, datastore_file_stub 42 from google.appengine.api import apiproxy_stub_map, datastore_file_stub
31 from google.appengine.api import memcache 43 from google.appengine.api import memcache
32 44
33 # See http://code.google.com/p/gaeunit/issues/detail?id=15 for clue. 45 # See http://code.google.com/p/gaeunit/issues/detail?id=15 for clue.
34 for key in ['datastore', 'datastore_v3']: 46 for key in ['datastore', 'datastore_v3']:
35 # W0212: 23,16:GaeTestCase.clear_datastore: Access to a protected member 47 # W0212: 23,16:GaeTestCase.clear_datastore: Access to a protected member
36 # _APIProxyStubMap__stub_map of a client class 48 # _APIProxyStubMap__stub_map of a client class
37 # E1101: 26,16:GaeTestCase.clear_datastore: Instance of 'APIProxyStubMap' 49 # pylint: disable=W0212
50 # E1101: 50,16:GaeTestCase.clear_datastore: Instance of 'APIProxyStubMap'
38 # has no '_APIProxyStubMap__stub_map' member 51 # has no '_APIProxyStubMap__stub_map' member
39 # pylint: disable=W0212,E1101 52 # pylint: disable=E1101
40 if key in apiproxy_stub_map.apiproxy._APIProxyStubMap__stub_map: 53 if key in apiproxy_stub_map.apiproxy._APIProxyStubMap__stub_map:
41 # W0212: 24,12:GaeTestCase.clear_datastore: Access to a protected 54 # W0212: 24,12:GaeTestCase.clear_datastore: Access to a protected
42 # member _APIProxyStubMap__stub_map of a client class 55 # member _APIProxyStubMap__stub_map of a client class
43 # E1101: 30,12:GaeTestCase.clear_datastore: Instance of 56 # pylint: disable=W0212
57 # E1101: 54,12:GaeTestCase.clear_datastore: Instance of
44 # 'APIProxyStubMap' has no '_APIProxyStubMap__stub_map' member 58 # 'APIProxyStubMap' has no '_APIProxyStubMap__stub_map' member
45 # pylint: disable=W0212,E1101 59 # pylint: disable=E1101
46 del apiproxy_stub_map.apiproxy._APIProxyStubMap__stub_map[key] 60 del apiproxy_stub_map.apiproxy._APIProxyStubMap__stub_map[key]
47 61
48 # Use a fresh stub datastore. 62 # Use a fresh stub datastore.
49 stub = datastore_file_stub.DatastoreFileStub( 63 stub = datastore_file_stub.DatastoreFileStub(
50 app.APP_NAME, '/dev/null', '/dev/null') 64 app.APP_NAME, '/dev/null', '/dev/null')
51 apiproxy_stub_map.apiproxy.RegisterStub('datastore', stub) 65 apiproxy_stub_map.apiproxy.RegisterStub('datastore', stub)
52 66
53 # Flush memcache. 67 # Flush memcache.
54 # E1101: 42,4:GaeTestCase.clear_datastore: Module
55 # 'google.appengine.api.memcache' has no 'flush_all' member
56 # pylint: disable=E1101
57 memcache.flush_all() 68 memcache.flush_all()
58 69
59 class MainTestCase(GaeTestCase): 70 class MainTestCase(GaeTestCase):
60 def test_main_page_redirect(self): 71 def test_main_page_redirect(self):
61 from webtest import TestApp 72 from webtest import TestApp
62 import handler 73 import handler
63 testapp = TestApp(handler.application) 74 testapp = TestApp(handler.application)
64 response = testapp.get('/') 75 response = testapp.get('/')
65 self.assertEquals('302 Moved Temporarily', response.status) 76 self.assertEquals('302 Moved Temporarily', response.status)
66 self.assertEquals('', response.body) 77 self.assertEquals('', response.body)
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 'Bad response: 404 Not Found (not 200 OK or 3xx redirect for ' 178 'Bad response: 404 Not Found (not 200 OK or 3xx redirect for '
168 'http://localhost/p/test)\n') 179 'http://localhost/p/test)\n')
169 180
170 # Verify that the path with the query string works. 181 # Verify that the path with the query string works.
171 response = testapp.get('/p/test?query') 182 response = testapp.get('/p/test?query')
172 self.assertEquals('200 OK', response.status) 183 self.assertEquals('200 OK', response.status)
173 self.assertEquals('Test Query.', response.body) 184 self.assertEquals('Test Query.', response.body)
174 185
175 class ConsoleTestCase(GaeTestCase): 186 class ConsoleTestCase(GaeTestCase):
176 def test_console_handler(self): 187 def test_console_handler(self):
177 test_dir = os.path.join(os.path.dirname(__file__), 188 test_dir = os.path.join(TEST_DIR, 'test_console_handler')
178 'tests',
179 'test_console_handler')
180 self.save_page(localpath='chromium/sheriff.js', 189 self.save_page(localpath='chromium/sheriff.js',
181 content='document.write(\'sheriff1\')') 190 content='document.write(\'sheriff1\')')
182 self.save_page(localpath='chromium/sheriff_webkit.js', 191 self.save_page(localpath='chromium/sheriff_webkit.js',
183 content='document.write(\'sheriff2\')') 192 content='document.write(\'sheriff2\')')
184 self.save_page(localpath='chromium/sheriff_memory.js', 193 self.save_page(localpath='chromium/sheriff_memory.js',
185 content='document.write(\'sheriff3\')') 194 content='document.write(\'sheriff3\')')
186 self.save_page(localpath='chromium/sheriff_nacl.js', 195 self.save_page(localpath='chromium/sheriff_nacl.js',
187 content='document.write(\'sheriff4\')') 196 content='document.write(\'sheriff4\')')
188 self.save_page(localpath='chromium/sheriff_perf.js', 197 self.save_page(localpath='chromium/sheriff_perf.js',
189 content='document.write(\'sheriff5\')') 198 content='document.write(\'sheriff5\')')
190 self.save_page(localpath='chromium/sheriff_cros_mtv.js', 199 self.save_page(localpath='chromium/sheriff_cros_mtv.js',
191 content='document.write(\'sheriff6, sheriff7\')') 200 content='document.write(\'sheriff6, sheriff7\')')
192 self.save_page(localpath='chromium/sheriff_cros_nonmtv.js', 201 self.save_page(localpath='chromium/sheriff_cros_nonmtv.js',
193 content='document.write(\'sheriff8\')') 202 content='document.write(\'sheriff8\')')
194 with open(os.path.join(test_dir, 'console-input.html')) as input_fh: 203 input_console = self._load_content(test_dir, 'console-input.html')
195 input_console = input_fh.read() 204 expected_console = self._load_content(test_dir, 'console-expected.html')
196 with open(os.path.join(test_dir, 'console-expected.html')) as expected_fh: 205 page_data = {'content': input_console}
197 expected_console = expected_fh.read()
198 actual_console = app.console_handler( 206 actual_console = app.console_handler(
199 unquoted_localpath='chromium/console', 207 _unquoted_localpath='chromium/console',
200 remoteurl='http://build.chromium.org/p/chromium/console', 208 remoteurl='http://build.chromium.org/p/chromium/console',
201 content=input_console) 209 page_data=page_data)
202 # Uncomment if deeper inspection is needed of the returned console. 210 # Uncomment if deeper inspection is needed of the returned console.
203 # with open(os.path.join(test_dir, 'console-expected.html'), 'w') as fh: 211 # with open(os.path.join(test_dir, 'console-expected.html'), 'w') as fh:
204 # fh.write(actual_console) 212 # fh.write(actual_console['content'])
205 self.assertEquals(expected_console, actual_console, 213 self.assertEquals(expected_console, actual_console['content'],
206 'Unexpected console output found') 214 'Unexpected console output found')
207 215
208 def test_console_handler_utf8(self): 216 def test_console_handler_utf8(self):
209 test_dir = os.path.join(os.path.dirname(__file__), 217 test_dir = os.path.join(TEST_DIR, 'test_console_handler_utf8')
210 'tests',
211 'test_console_handler_utf8')
212 self.save_page(localpath='chromium/sheriff.js', 218 self.save_page(localpath='chromium/sheriff.js',
213 content='document.write(\'sheriff1\')') 219 content='document.write(\'sheriff1\')')
214 self.save_page(localpath='chromium/sheriff_webkit.js', 220 self.save_page(localpath='chromium/sheriff_webkit.js',
215 content='document.write(\'sheriff2\')') 221 content='document.write(\'sheriff2\')')
216 self.save_page(localpath='chromium/sheriff_memory.js', 222 self.save_page(localpath='chromium/sheriff_memory.js',
217 content='document.write(\'sheriff3\')') 223 content='document.write(\'sheriff3\')')
218 self.save_page(localpath='chromium/sheriff_nacl.js', 224 self.save_page(localpath='chromium/sheriff_nacl.js',
219 content='document.write(\'sheriff4\')') 225 content='document.write(\'sheriff4\')')
220 self.save_page(localpath='chromium/sheriff_perf.js', 226 self.save_page(localpath='chromium/sheriff_perf.js',
221 content='document.write(\'sheriff5\')') 227 content='document.write(\'sheriff5\')')
222 self.save_page(localpath='chromium/sheriff_cros_mtv.js', 228 self.save_page(localpath='chromium/sheriff_cros_mtv.js',
223 content='document.write(\'sheriff6, sheriff7\')') 229 content='document.write(\'sheriff6, sheriff7\')')
224 self.save_page(localpath='chromium/sheriff_cros_nonmtv.js', 230 self.save_page(localpath='chromium/sheriff_cros_nonmtv.js',
225 content='document.write(\'sheriff8\')') 231 content='document.write(\'sheriff8\')')
226 with open(os.path.join(test_dir, 'console-input.html')) as input_fh: 232 input_console = self._load_content(test_dir, 'console-input.html')
227 input_console = input_fh.read() 233 expected_console = self._load_content(test_dir, 'console-expected.html')
228 with open(os.path.join(test_dir, 'console-expected.html')) as expected_fh: 234 page_data = {'content': input_console}
229 expected_console = expected_fh.read()
230 actual_console = app.console_handler( 235 actual_console = app.console_handler(
231 unquoted_localpath='chromium/console', 236 _unquoted_localpath='chromium/console',
232 remoteurl='http://build.chromium.org/p/chromium/console', 237 remoteurl='http://build.chromium.org/p/chromium/console',
233 content=input_console) 238 page_data=page_data)
234 # Uncomment if deeper inspection is needed of the returned console. 239 # Uncomment if deeper inspection is needed of the returned console.
235 # with open(os.path.join(test_dir, 'console-expected.html'), 'w') as fh: 240 # with open(os.path.join(test_dir, 'console-expected.html'), 'w') as fh:
236 # fh.write(actual_console) 241 # fh.write(actual_console['content'])
237 self.assertEquals(expected_console, actual_console, 242 self.assertEquals(expected_console, actual_console['content'],
238 'Unexpected console output found') 243 'Unexpected console output found')
239 244
240 def test_console_merger(self): 245 def test_console_merger(self):
241 test_dir = os.path.join(os.path.dirname(__file__), 246 test_dir = os.path.join(TEST_DIR, 'test_console_merger')
242 'tests',
243 'test_console_merger')
244 filedata = {} 247 filedata = {}
245 for filename in [ 248 for filename in [
246 'chromium_chrome_console_input.html', 249 'chromium_chrome_console_input.html',
247 'chromium_chromiumos_console_input.html', 250 'chromium_chromiumos_console_input.html',
248 'chromium_main_console_input.html', 251 'chromium_main_console_input.html',
249 'chromium_memory_console_input.html', 252 'chromium_memory_console_input.html',
250 'chromium_merged_console.html', 253 'chromium_merged_console.html',
251 ]: 254 ]:
252 with open(os.path.join(test_dir, filename)) as fh: 255 filedata[filename] = self._load_content(test_dir, filename)
253 filedata[filename] = fh.read()
254 self.save_page(localpath='chromium.chrome/console', 256 self.save_page(localpath='chromium.chrome/console',
255 content=filedata['chromium_chrome_console_input.html']) 257 content=filedata['chromium_chrome_console_input.html'])
256 self.save_page(localpath='chromium.chromiumos/console', 258 self.save_page(localpath='chromium.chromiumos/console',
257 content=filedata['chromium_chromiumos_console_input.html']) 259 content=filedata['chromium_chromiumos_console_input.html'])
258 self.save_page(localpath='chromium.main/console', 260 self.save_page(localpath='chromium.main/console',
259 content=filedata['chromium_main_console_input.html']) 261 content=filedata['chromium_main_console_input.html'])
260 self.save_page(localpath='chromium.memory/console', 262 self.save_page(localpath='chromium.memory/console',
261 content=filedata['chromium_memory_console_input.html']) 263 content=filedata['chromium_memory_console_input.html'])
262 actual_mergedconsole = app.console_merger( 264 page_data = {'content': filedata['chromium_merged_console.html']}
265 app.console_merger(
263 'chromium.main/console', 266 'chromium.main/console',
264 'http://build.chromium.org/p/chromium/console', 267 'http://build.chromium.org/p/chromium/console',
265 content=filedata['chromium_merged_console.html']) 268 page_data=page_data)
269 actual_mergedconsole = app.get_and_cache_pagedata('chromium/console')
266 # Uncomment if deeper inspection is needed of the returned console. 270 # Uncomment if deeper inspection is needed of the returned console.
267 # import logging 271 # import logging
268 # logging.debug('foo') 272 # logging.debug('foo')
269 # with open(os.path.join(test_dir, 'chromium_merged_console.html'), 273 # with open(os.path.join(test_dir, 'chromium_merged_console.html'),
270 # 'w') as fh: 274 # 'w') as fh:
271 # fh.write(actual_mergedconsole) 275 # fh.write(actual_mergedconsole['content'])
272 # import code 276 # import code
273 # code.interact(local=locals()) 277 # code.interact(local=locals())
274 self.assertEquals(filedata['chromium_merged_console.html'], 278 self.assertEquals(filedata['chromium_merged_console.html'],
275 actual_mergedconsole, 279 actual_mergedconsole['content'],
276 'Unexpected console output found') 280 'Unexpected console output found')
277 281
278 def test_console_merger_utf8(self): 282 def test_console_merger_utf8(self):
279 test_dir = os.path.join(os.path.dirname(__file__), 283 test_dir = os.path.join(TEST_DIR, 'test_console_merger_utf8')
280 'tests',
281 'test_console_merger_utf8')
282 filedata = {} 284 filedata = {}
283 for filename in [ 285 for filename in [
284 'chromium_chrome_console_input.html', 286 'chromium_chrome_console_input.html',
285 'chromium_chromiumos_console_input.html', 287 'chromium_chromiumos_console_input.html',
286 'chromium_main_console_input.html', 288 'chromium_main_console_input.html',
287 'chromium_memory_console_input.html', 289 'chromium_memory_console_input.html',
288 'chromium_merged_console.html', 290 'chromium_merged_console.html',
289 ]: 291 ]:
290 with open(os.path.join(test_dir, filename)) as fh: 292 filedata[filename] = self._load_content(test_dir, filename)
291 filedata[filename] = fh.read()
292 self.save_page(localpath='chromium.chrome/console', 293 self.save_page(localpath='chromium.chrome/console',
293 content=filedata['chromium_chrome_console_input.html']) 294 content=filedata['chromium_chrome_console_input.html'])
294 self.save_page(localpath='chromium.chromiumos/console', 295 self.save_page(localpath='chromium.chromiumos/console',
295 content=filedata['chromium_chromiumos_console_input.html']) 296 content=filedata['chromium_chromiumos_console_input.html'])
296 self.save_page(localpath='chromium.main/console', 297 self.save_page(localpath='chromium.main/console',
297 content=filedata['chromium_main_console_input.html']) 298 content=filedata['chromium_main_console_input.html'])
298 self.save_page(localpath='chromium.memory/console', 299 self.save_page(localpath='chromium.memory/console',
299 content=filedata['chromium_memory_console_input.html']) 300 content=filedata['chromium_memory_console_input.html'])
300 actual_mergedconsole = app.console_merger( 301 page_data = {'content': filedata['chromium_merged_console.html']}
302 app.console_merger(
301 'chromium.main/console', 303 'chromium.main/console',
302 'http://build.chromium.org/p/chromium/console', 304 'http://build.chromium.org/p/chromium/console',
303 content=filedata['chromium_merged_console.html']) 305 page_data=page_data)
306 actual_mergedconsole = app.get_and_cache_pagedata('chromium/console')
304 # Uncomment if deeper inspection is needed of the returned console. 307 # Uncomment if deeper inspection is needed of the returned console.
305 # import logging 308 # import logging
306 # logging.debug('foo') 309 # logging.debug('foo')
307 # merged_path = os.path.join(test_dir, 'chromium_merged_console.html') 310 # merged_path = os.path.join(test_dir, 'chromium_merged_console.html')
308 # with open(merged_path, 'w') as fh: 311 # with open(merged_path, 'w') as fh:
309 # fh.write(actual_mergedconsole) 312 # fh.write(actual_mergedconsole['content'])
310 # import code 313 # import code
311 # code.interact(local=locals()) 314 # code.interact(local=locals())
312 self.assertEquals(filedata['chromium_merged_console.html'], 315 self.assertEquals(filedata['chromium_merged_console.html'],
313 actual_mergedconsole, 316 actual_mergedconsole['content'],
314 'Unexpected console output found') 317 'Unexpected console output found')
315 318
316 def test_console_merger_splitrevs(self): 319 def test_console_merger_splitrevs(self):
317 test_dir = os.path.join(os.path.dirname(__file__), 320 test_dir = os.path.join(TEST_DIR, 'test_console_merger_splitrevs')
318 'tests',
319 'test_console_merger_splitrevs')
320 filedata = {} 321 filedata = {}
321 for filename in [ 322 for filename in [
322 'chromium_chrome_console.html', 323 'chromium_chrome_console.html',
323 'chromium_chromiumos_console.html', 324 'chromium_chromiumos_console.html',
324 'chromium_console.html', 325 'chromium_console.html',
325 'chromium_memory_console.html', 326 'chromium_memory_console.html',
326 'chromium_merged_console.html', 327 'chromium_merged_console.html',
327 ]: 328 ]:
328 with open(os.path.join(test_dir, filename)) as fh: 329 filedata[filename] = self._load_content(test_dir, filename)
329 filedata[filename] = fh.read()
330 self.save_page(localpath='chromium.chrome/console', 330 self.save_page(localpath='chromium.chrome/console',
331 content=filedata['chromium_chrome_console.html']) 331 content=filedata['chromium_chrome_console.html'])
332 self.save_page(localpath='chromium.chromiumos/console', 332 self.save_page(localpath='chromium.chromiumos/console',
333 content=filedata['chromium_chromiumos_console.html']) 333 content=filedata['chromium_chromiumos_console.html'])
334 self.save_page(localpath='chromium.main/console', 334 self.save_page(localpath='chromium.main/console',
335 content=filedata['chromium_console.html']) 335 content=filedata['chromium_console.html'])
336 self.save_page(localpath='chromium.memory/console', 336 self.save_page(localpath='chromium.memory/console',
337 content=filedata['chromium_memory_console.html']) 337 content=filedata['chromium_memory_console.html'])
338 actual_mergedconsole = app.console_merger( 338 page_data = {'content': filedata['chromium_merged_console.html']}
339 app.console_merger(
339 'chromium.main/console', 340 'chromium.main/console',
340 'http://build.chromium.org/p/chromium/console', 341 'http://build.chromium.org/p/chromium/console',
341 content=filedata['chromium_merged_console.html']) 342 page_data=page_data)
343 actual_mergedconsole = app.get_and_cache_pagedata('chromium/console')
342 # Uncomment if deeper inspection is needed of the returned console. 344 # Uncomment if deeper inspection is needed of the returned console.
343 # import logging 345 # import logging
344 # logging.debug('foo') 346 # logging.debug('foo')
345 # with open(os.path.join(test_dir, 'chromium_merged_console.html'), 347 # with open(os.path.join(test_dir, 'chromium_merged_console.html'),
346 # 'w') as fh: 348 # 'w') as fh:
347 # fh.write(actual_mergedconsole) 349 # fh.write(actual_mergedconsole['content'])
348 # import code 350 # import code
349 # code.interact(local=locals()) 351 # code.interact(local=locals())
350 self.assertEquals(filedata['chromium_merged_console.html'], 352 self.assertEquals(filedata['chromium_merged_console.html'],
351 actual_mergedconsole, 353 actual_mergedconsole['content'],
352 'Unexpected console output found') 354 'Unexpected console output found')
355
356
357 class FetchTestCase(GaeTestCase):
358 class FakeResponse(object):
359 status_code = 200
360 content = None
361
362 def test_fetch_direct(self):
363 test_dir = os.path.join(TEST_DIR, 'test_fetch_direct')
364
365 def fetch_url(url):
366 fr = FetchTestCase.FakeResponse()
367 if url == 'http://build.chromium.org/p/chromium/console':
368 fr.content = self._load_content(test_dir, 'input.html')
369 return fr
370
371 expected_content = self._load_content(test_dir, 'expected.html')
372 app.fetch_page(
373 localpath='chromium/console',
374 remoteurl='http://build.chromium.org/p/chromium/console',
375 maxage=60,
376 fetch_url=fetch_url)
377 page = app.get_and_cache_pagedata('chromium/console')
378 # Uncomment if deeper inspection is needed of the returned console.
379 # with open(os.path.join(test_dir, 'expected.html'), 'w') as fh:
380 # fh.write(page['content'])
381 self.assertEquals(expected_content, page['content'])
382
383 def test_fetch_console(self):
384 test_dir = os.path.join(TEST_DIR, 'test_fetch_console')
385
386 def fetch_url(url):
387 fr = FetchTestCase.FakeResponse()
388 if url == 'http://build.chromium.org/p/chromium/console':
389 fr.content = self._load_content(test_dir, 'input.html')
390 return fr
391
392 expected_content = self._load_content(test_dir, 'expected.html')
393 app.fetch_page(
394 localpath='chromium/console',
395 remoteurl='http://build.chromium.org/p/chromium/console',
396 maxage=60,
397 postfetch=app.console_handler,
398 fetch_url=fetch_url)
399 page = app.get_and_cache_pagedata('chromium/console')
400 # Uncomment if deeper inspection is needed of the returned console.
401 # with open(os.path.join(test_dir, 'expected.html'), 'w') as fh:
402 # fh.write(page['content'])
403 self.assertEquals('interface', page['body_class'])
404 self.assertEquals(expected_content, page['content'])
405 self.assertEquals(
406 'http://build.chromium.org/p/chromium/console/../',
407 page['offsite_base'])
408 self.assertEquals('BuildBot: Chromium', page['title'])
OLDNEW
« no previous file with comments | « app.py ('k') | base_page.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698