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

Side by Side Diff: content/browser/loader/resource_scheduler_unittest.cc

Issue 658163002: Fixed resource scheduler to not treat non-blocking js as render-blocking (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unit test added Created 6 years, 2 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
« no previous file with comments | « content/browser/loader/resource_scheduler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "content/browser/loader/resource_scheduler.h" 5 #include "content/browser/loader/resource_scheduler.h"
6 6
7 #include "base/memory/scoped_vector.h" 7 #include "base/memory/scoped_vector.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 scoped_ptr<TestRequest> low2(NewRequest("http://host/low", net::LOWEST)); 320 scoped_ptr<TestRequest> low2(NewRequest("http://host/low", net::LOWEST));
321 EXPECT_TRUE(high->started()); 321 EXPECT_TRUE(high->started());
322 EXPECT_TRUE(low->started()); 322 EXPECT_TRUE(low->started());
323 EXPECT_FALSE(low2->started()); 323 EXPECT_FALSE(low2->started());
324 scheduler_.OnWillInsertBody(kChildId, kRouteId); 324 scheduler_.OnWillInsertBody(kChildId, kRouteId);
325 EXPECT_FALSE(low2->started()); 325 EXPECT_FALSE(low2->started());
326 high.reset(); 326 high.reset();
327 EXPECT_TRUE(low2->started()); 327 EXPECT_TRUE(low2->started());
328 } 328 }
329 329
330 TEST_F(ResourceSchedulerTest, LowDoesNotBlockCriticalComplete) {
331 scoped_ptr<TestRequest> low(NewRequest("http://host/low", net::LOW));
332 scoped_ptr<TestRequest> lowest(NewRequest("http://host/lowest", net::LOWEST));
333 scoped_ptr<TestRequest> lowest2(NewRequest("http://host/lowest", net::LOWEST)) ;
mmenke 2014/10/16 17:19:42 nit: Fix line length.
Pat Meenan 2014/10/16 18:20:55 Done.
334 EXPECT_TRUE(low->started());
335 EXPECT_TRUE(lowest->started());
336 EXPECT_FALSE(lowest2->started());
337 scheduler_.OnWillInsertBody(kChildId, kRouteId);
338 EXPECT_TRUE(lowest2->started());
339 }
340
330 TEST_F(ResourceSchedulerTest, OneLowLoadsUntilBodyInsertedExceptSpdy) { 341 TEST_F(ResourceSchedulerTest, OneLowLoadsUntilBodyInsertedExceptSpdy) {
331 http_server_properties_.SetSupportsSpdy( 342 http_server_properties_.SetSupportsSpdy(
332 net::HostPortPair("spdyhost", 443), true); 343 net::HostPortPair("spdyhost", 443), true);
333 scoped_ptr<TestRequest> high(NewRequest("http://host/high", net::HIGHEST)); 344 scoped_ptr<TestRequest> high(NewRequest("http://host/high", net::HIGHEST));
334 scoped_ptr<TestRequest> low_spdy( 345 scoped_ptr<TestRequest> low_spdy(
335 NewRequest("https://spdyhost/low", net::LOWEST)); 346 NewRequest("https://spdyhost/low", net::LOWEST));
336 scoped_ptr<TestRequest> low(NewRequest("http://host/low", net::LOWEST)); 347 scoped_ptr<TestRequest> low(NewRequest("http://host/low", net::LOWEST));
337 scoped_ptr<TestRequest> low2(NewRequest("http://host/low", net::LOWEST)); 348 scoped_ptr<TestRequest> low2(NewRequest("http://host/low", net::LOWEST));
338 EXPECT_TRUE(high->started()); 349 EXPECT_TRUE(high->started());
339 EXPECT_TRUE(low_spdy->started()); 350 EXPECT_TRUE(low_spdy->started());
(...skipping 1851 matching lines...) Expand 10 before | Expand all | Expand 10 after
2191 web_contents_2.reset(); 2202 web_contents_2.reset();
2192 base::RunLoop().RunUntilIdle(); 2203 base::RunLoop().RunUntilIdle();
2193 2204
2194 browser_context.reset(); 2205 browser_context.reset();
2195 render_process_host_factory.reset(); 2206 render_process_host_factory.reset();
2196 } 2207 }
2197 2208
2198 } // unnamed namespace 2209 } // unnamed namespace
2199 2210
2200 } // namespace content 2211 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/resource_scheduler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698