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

Unified Diff: tools/telemetry/telemetry/core/memory_cache_http_server_unittest.py

Issue 1647513002: Delete tools/telemetry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/telemetry/core/memory_cache_http_server_unittest.py
diff --git a/tools/telemetry/telemetry/core/memory_cache_http_server_unittest.py b/tools/telemetry/telemetry/core/memory_cache_http_server_unittest.py
deleted file mode 100644
index 32ea3ca6265a1c56930636354ef6168a98a47507..0000000000000000000000000000000000000000
--- a/tools/telemetry/telemetry/core/memory_cache_http_server_unittest.py
+++ /dev/null
@@ -1,66 +0,0 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import os
-
-from telemetry.core import util
-from telemetry.testing import tab_test_case
-
-
-class MemoryCacheHTTPServerTest(tab_test_case.TabTestCase):
-
- def setUp(self):
- super(MemoryCacheHTTPServerTest, self).setUp()
- self._test_filename = 'bear.webm'
- _test_file = os.path.join(util.GetUnittestDataDir(), 'bear.webm')
- self._test_file_size = os.stat(_test_file).st_size
-
- def testBasicHostingAndRangeRequests(self):
- self.Navigate('blank.html')
- x = self._tab.EvaluateJavaScript('document.body.innerHTML')
- x = x.strip()
-
- # Test basic html hosting.
- self.assertEquals(x, 'Hello world')
-
- file_size = self._test_file_size
- last_byte = file_size - 1
- # Test byte range request: no end byte.
- self.CheckContentHeaders('0-', '0-%d' % last_byte, file_size)
-
- # Test byte range request: greater than zero start byte.
- self.CheckContentHeaders('100-', '100-%d' % last_byte, file_size - 100)
-
- # Test byte range request: explicit byte range.
- self.CheckContentHeaders('2-500', '2-500', '499')
-
- # Test byte range request: no start byte.
- self.CheckContentHeaders('-228', '%d-%d' % (file_size - 228, last_byte),
- '228')
-
- # Test byte range request: end byte less than start byte.
- self.CheckContentHeaders('100-5', '100-%d' % last_byte, file_size - 100)
-
- def CheckContentHeaders(self, content_range_request, content_range_response,
- content_length_response):
- self._tab.ExecuteJavaScript("""
- var loaded = false;
- var xmlhttp = new XMLHttpRequest();
- xmlhttp.onload = function(e) {
- loaded = true;
- };
- // Avoid cached content by appending unique URL param.
- xmlhttp.open('GET', "%s?t=" + Date.now(), true);
- xmlhttp.setRequestHeader('Range', 'bytes=%s');
- xmlhttp.send();
- """ % (self.UrlOfUnittestFile(self._test_filename), content_range_request))
- self._tab.WaitForJavaScriptExpression('loaded', 5)
- content_range = self._tab.EvaluateJavaScript(
- 'xmlhttp.getResponseHeader("Content-Range");')
- content_range_response = 'bytes %s/%d' % (content_range_response,
- self._test_file_size)
- self.assertEquals(content_range, content_range_response)
- content_length = self._tab.EvaluateJavaScript(
- 'xmlhttp.getResponseHeader("Content-Length");')
- self.assertEquals(content_length, str(content_length_response))
« no previous file with comments | « tools/telemetry/telemetry/core/memory_cache_http_server.py ('k') | tools/telemetry/telemetry/core/network_controller.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698