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

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

Issue 2335133003: PlzNavigate: support the WebRequest API (Closed)
Patch Set: Addressed comments + removed test filter changes Created 4 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
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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after
1085 TestNavigationURLLoaderDelegate delegate; 1085 TestNavigationURLLoaderDelegate delegate;
1086 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false, 1086 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false,
1087 false, REQUEST_CONTEXT_TYPE_LOCATION); 1087 false, REQUEST_CONTEXT_TYPE_LOCATION);
1088 CommonNavigationParams common_params; 1088 CommonNavigationParams common_params;
1089 common_params.url = url; 1089 common_params.url = url;
1090 std::unique_ptr<NavigationRequestInfo> request_info( 1090 std::unique_ptr<NavigationRequestInfo> request_info(
1091 new NavigationRequestInfo(common_params, begin_params, url, 1091 new NavigationRequestInfo(common_params, begin_params, url,
1092 url::Origin(url), true, false, false, -1)); 1092 url::Origin(url), true, false, false, -1));
1093 std::unique_ptr<NavigationURLLoader> test_loader = 1093 std::unique_ptr<NavigationURLLoader> test_loader =
1094 NavigationURLLoader::Create(browser_context_.get(), 1094 NavigationURLLoader::Create(browser_context_.get(),
1095 std::move(request_info), nullptr, 1095 std::move(request_info), nullptr, nullptr,
1096 &delegate); 1096 &delegate);
1097 1097
1098 // The navigation should fail with the expected error code. 1098 // The navigation should fail with the expected error code.
1099 delegate.WaitForRequestFailed(); 1099 delegate.WaitForRequestFailed();
1100 ASSERT_EQ(expected_error_code, delegate.net_error()); 1100 ASSERT_EQ(expected_error_code, delegate.net_error());
1101 return; 1101 return;
1102 } 1102 }
1103 1103
1104 MakeTestRequestWithResourceType(filter_.get(), 0, 1, url, 1104 MakeTestRequestWithResourceType(filter_.get(), 0, 1, url,
1105 RESOURCE_TYPE_MAIN_FRAME); 1105 RESOURCE_TYPE_MAIN_FRAME);
(...skipping 1462 matching lines...) Expand 10 before | Expand all | Expand 10 after
2568 TestNavigationURLLoaderDelegate delegate; 2568 TestNavigationURLLoaderDelegate delegate;
2569 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false, 2569 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false,
2570 false, REQUEST_CONTEXT_TYPE_LOCATION); 2570 false, REQUEST_CONTEXT_TYPE_LOCATION);
2571 CommonNavigationParams common_params; 2571 CommonNavigationParams common_params;
2572 common_params.url = download_url; 2572 common_params.url = download_url;
2573 std::unique_ptr<NavigationRequestInfo> request_info( 2573 std::unique_ptr<NavigationRequestInfo> request_info(
2574 new NavigationRequestInfo(common_params, begin_params, download_url, 2574 new NavigationRequestInfo(common_params, begin_params, download_url,
2575 url::Origin(download_url), true, false, false, 2575 url::Origin(download_url), true, false, false,
2576 -1)); 2576 -1));
2577 std::unique_ptr<NavigationURLLoader> loader = NavigationURLLoader::Create( 2577 std::unique_ptr<NavigationURLLoader> loader = NavigationURLLoader::Create(
2578 browser_context_.get(), std::move(request_info), nullptr, &delegate); 2578 browser_context_.get(), std::move(request_info), nullptr, nullptr,
2579 &delegate);
2579 2580
2580 // Wait until a response has been received and proceed with the response. 2581 // Wait until a response has been received and proceed with the response.
2581 KickOffRequest(); 2582 KickOffRequest();
2582 2583
2583 // Return some data so that the request is identified as a download 2584 // Return some data so that the request is identified as a download
2584 // and the proper resource handlers are created. 2585 // and the proper resource handlers are created.
2585 EXPECT_TRUE(net::URLRequestTestJob::ProcessOnePendingMessage()); 2586 EXPECT_TRUE(net::URLRequestTestJob::ProcessOnePendingMessage());
2586 base::RunLoop().RunUntilIdle(); 2587 base::RunLoop().RunUntilIdle();
2587 2588
2588 // The UI thread will be informed that the navigation failed with an error 2589 // The UI thread will be informed that the navigation failed with an error
(...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after
3819 return nullptr; 3820 return nullptr;
3820 } 3821 }
3821 3822
3822 INSTANTIATE_TEST_CASE_P( 3823 INSTANTIATE_TEST_CASE_P(
3823 ResourceDispatcherHostTests, 3824 ResourceDispatcherHostTests,
3824 ResourceDispatcherHostTest, 3825 ResourceDispatcherHostTest,
3825 testing::Values(TestConfig::kDefault, 3826 testing::Values(TestConfig::kDefault,
3826 TestConfig::kOptimizeIPCForSmallResourceEnabled)); 3827 TestConfig::kOptimizeIPCForSmallResourceEnabled));
3827 3828
3828 } // namespace content 3829 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698