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

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

Issue 2526983002: Refactor ResourceHandler API. (Closed)
Patch Set: Response to comments Created 3 years, 10 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/mojo_async_resource_handler.h" 5 #include "content/browser/loader/mojo_async_resource_handler.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 EXPECT_EQ(1, rdh_.num_in_flight_requests_for_testing()); 537 EXPECT_EQ(1, rdh_.num_in_flight_requests_for_testing());
538 handler_ = nullptr; 538 handler_ = nullptr;
539 EXPECT_EQ(0, rdh_.num_in_flight_requests_for_testing()); 539 EXPECT_EQ(0, rdh_.num_in_flight_requests_for_testing());
540 } 540 }
541 541
542 TEST_F(MojoAsyncResourceHandlerTest, OnWillReadWithInsufficientResource) { 542 TEST_F(MojoAsyncResourceHandlerTest, OnWillReadWithInsufficientResource) {
543 rdh_.set_max_num_in_flight_requests_per_process(0); 543 rdh_.set_max_num_in_flight_requests_per_process(0);
544 ASSERT_TRUE(CallOnWillStartAndOnResponseStarted()); 544 ASSERT_TRUE(CallOnWillStartAndOnResponseStarted());
545 545
546 ASSERT_EQ(MockResourceLoader::Status::CANCELED, mock_loader_->OnWillRead(-1)); 546 ASSERT_EQ(MockResourceLoader::Status::CANCELED, mock_loader_->OnWillRead(-1));
547 EXPECT_EQ(net::ERR_INSUFFICIENT_RESOURCES, mock_loader_->error_code()); 547 // TODO(mmenke): Make this fail with net::ERR_INSUFFICIENT_RESOURCES.
548 EXPECT_EQ(net::ERR_ABORTED, mock_loader_->error_code());
548 EXPECT_EQ(1, rdh_.num_in_flight_requests_for_testing()); 549 EXPECT_EQ(1, rdh_.num_in_flight_requests_for_testing());
549 handler_ = nullptr; 550 handler_ = nullptr;
550 EXPECT_EQ(0, rdh_.num_in_flight_requests_for_testing()); 551 EXPECT_EQ(0, rdh_.num_in_flight_requests_for_testing());
551 } 552 }
552 553
553 TEST_F(MojoAsyncResourceHandlerTest, OnWillReadAndOnReadCompleted) { 554 TEST_F(MojoAsyncResourceHandlerTest, OnWillReadAndOnReadCompleted) {
554 ASSERT_TRUE(CallOnWillStartAndOnResponseStarted()); 555 ASSERT_TRUE(CallOnWillStartAndOnResponseStarted());
555 ASSERT_EQ(MockResourceLoader::Status::IDLE, mock_loader_->OnWillRead(-1)); 556 ASSERT_EQ(MockResourceLoader::Status::IDLE, mock_loader_->OnWillRead(-1));
556 // The buffer size that the mime sniffer requires implicitly. 557 // The buffer size that the mime sniffer requires implicitly.
557 ASSERT_GE(mock_loader_->io_buffer_size(), 558 ASSERT_GE(mock_loader_->io_buffer_size(),
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 } 1283 }
1283 } 1284 }
1284 EXPECT_EQ("B", body); 1285 EXPECT_EQ("B", body);
1285 } 1286 }
1286 1287
1287 INSTANTIATE_TEST_CASE_P(MojoAsyncResourceHandlerWithAllocationSizeTest, 1288 INSTANTIATE_TEST_CASE_P(MojoAsyncResourceHandlerWithAllocationSizeTest,
1288 MojoAsyncResourceHandlerWithAllocationSizeTest, 1289 MojoAsyncResourceHandlerWithAllocationSizeTest,
1289 ::testing::Values(8, 32 * 2014)); 1290 ::testing::Values(8, 32 * 2014));
1290 } // namespace 1291 } // namespace
1291 } // namespace content 1292 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/mojo_async_resource_handler.cc ('k') | content/browser/loader/navigation_resource_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698