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

Unified Diff: webkit/glue/devtools/js/tests.js

Issue 295041: DevTools: report correct content length for resources (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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
« no previous file with comments | « webkit/api/src/ResourceHandle.cpp ('k') | webkit/glue/ftp_directory_listing_response_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/devtools/js/tests.js
===================================================================
--- webkit/glue/devtools/js/tests.js (revision 30714)
+++ webkit/glue/devtools/js/tests.js (working copy)
@@ -246,6 +246,63 @@
/**
+ * Tests that correct content length is reported for resources.
+ */
+TestSuite.prototype.testResourceContentLength = function() {
+ this.showPanel('resources');
+ var test = this;
+
+ var png = false;
+ var html = false;
+ this.addSniffer(WebInspector, 'updateResource',
+ function(identifier, payload) {
+ if (!payload.didLengthChange)
+ return;
+ var resource = WebInspector.resources[identifier];
+ if (!resource || !resource.url)
+ return;
+ if (resource.url.search('image.html$') != -1) {
+ var expectedLength = 93;
+ test.assertTrue(
+ resource.contentLength <= expectedLength,
+ 'image.html content length is greater thatn expected.');
+ if (expectedLength == resource.contentLength) {
+ html = true;
+ }
+ } else if (resource.url.search('image.png') != -1) {
+ var expectedLength = 257796;
+ test.assertTrue(
+ resource.contentLength <= expectedLength,
+ 'image.png content length is greater than expected.');
+ if (expectedLength == resource.contentLength) {
+ png = true;
+ }
+ }
+ if (html && png) {
+ // Wait 1 second before releasing control to check that the content
+ // lengths are not updated anymore.
+ setTimeout(function() {
+ test.releaseControl();
+ }, 1000);
+ }
+ }, true);
+
+ // Make sure resource tracking is on.
+ WebInspector.panels.resources._enableResourceTracking();
+ // Reload inspected page to update all resources.
+ test.evaluateInConsole_(
+ 'window.location.reload(true);',
+ function(resultText) {
+ test.assertEquals('undefined', resultText,
+ 'Unexpected result of reload().');
+ });
+
+ // We now have some time to report results to controller.
+ this.takeControl();
+};
+
+
+/**
* Tests resource headers.
*/
TestSuite.prototype.testResourceHeaders = function() {
« no previous file with comments | « webkit/api/src/ResourceHandle.cpp ('k') | webkit/glue/ftp_directory_listing_response_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698