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

Side by Side Diff: telemetry/telemetry/core/memory_cache_http_server_unittest.py

Issue 2978643002: Removing bad-continuation param and fixing resulting errors. Fixed indentation errors, in telemetry… (Closed)
Patch Set: Created 3 years, 5 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
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 os 5 import os
6 6
7 from telemetry.core import util 7 from telemetry.core import util
8 from telemetry.testing import tab_test_case 8 from telemetry.testing import tab_test_case
9 9
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 self._tab.ExecuteJavaScript(""" 47 self._tab.ExecuteJavaScript("""
48 var loaded = false; 48 var loaded = false;
49 var xmlhttp = new XMLHttpRequest(); 49 var xmlhttp = new XMLHttpRequest();
50 xmlhttp.onload = function(e) { 50 xmlhttp.onload = function(e) {
51 loaded = true; 51 loaded = true;
52 }; 52 };
53 // Avoid cached content by appending unique URL param. 53 // Avoid cached content by appending unique URL param.
54 xmlhttp.open('GET', {{ url }} + "?t=" + Date.now(), true); 54 xmlhttp.open('GET', {{ url }} + "?t=" + Date.now(), true);
55 xmlhttp.setRequestHeader('Range', {{ range }}); 55 xmlhttp.setRequestHeader('Range', {{ range }});
56 xmlhttp.send(); 56 xmlhttp.send();
57 """, 57 """,\
58 url=self.UrlOfUnittestFile(self._test_filename), 58 url=self.UrlOfUnittestFile(self._test_filename),\
59 range='bytes=%s' % content_range_request) 59 range='bytes=%s' % content_range_request)
60 self._tab.WaitForJavaScriptCondition('loaded', timeout=5) 60 self._tab.WaitForJavaScriptCondition('loaded', timeout=5)
61 content_range = self._tab.EvaluateJavaScript( 61 content_range = self._tab.EvaluateJavaScript(
62 'xmlhttp.getResponseHeader("Content-Range");') 62 'xmlhttp.getResponseHeader("Content-Range");')
63 content_range_response = 'bytes %s/%d' % (content_range_response, 63 content_range_response = 'bytes %s/%d' % (content_range_response,
64 self._test_file_size) 64 self._test_file_size)
65 self.assertEquals(content_range, content_range_response) 65 self.assertEquals(content_range, content_range_response)
66 content_length = self._tab.EvaluateJavaScript( 66 content_length = self._tab.EvaluateJavaScript(
67 'xmlhttp.getResponseHeader("Content-Length");') 67 'xmlhttp.getResponseHeader("Content-Length");')
68 self.assertEquals(content_length, str(content_length_response)) 68 self.assertEquals(content_length, str(content_length_response))
69 69
70 def testAbsoluteAndRelativePathsYieldSameURL(self): 70 def testAbsoluteAndRelativePathsYieldSameURL(self):
71 test_file_rel_path = 'green_rect.html' 71 test_file_rel_path = 'green_rect.html'
72 test_file_abs_path = os.path.abspath(os.path.join(util.GetUnittestDataDir(), 72 test_file_abs_path = os.path.abspath(os.path.join(util.GetUnittestDataDir(),
73 test_file_rel_path)) 73 test_file_rel_path))
74 # It's necessary to bypass self.UrlOfUnittestFile since that 74 # It's necessary to bypass self.UrlOfUnittestFile since that
75 # concatenates the unittest directory on to the incoming path, 75 # concatenates the unittest directory on to the incoming path,
76 # causing the same code path to be taken in both cases. 76 # causing the same code path to be taken in both cases.
77 self._platform.SetHTTPServerDirectories(util.GetUnittestDataDir()) 77 self._platform.SetHTTPServerDirectories(util.GetUnittestDataDir())
78 self.assertEquals( 78 self.assertEquals(\
79 self._platform.http_server.UrlOf(test_file_rel_path), 79 self._platform.http_server.UrlOf(test_file_rel_path),
80 self._platform.http_server.UrlOf(test_file_abs_path)) 80 self._platform.http_server.UrlOf(test_file_abs_path))
OLDNEW
« no previous file with comments | « telemetry/telemetry/core/android_action_runner_unittest.py ('k') | telemetry/telemetry/core/network_controller.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698