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

Side by Side Diff: content/browser/background_fetch/background_fetch_job_controller_unittest.cc

Issue 2814683003: Pass through the response code and headers in Background Fetch (Closed)
Patch Set: Created 3 years, 8 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/background_fetch/background_fetch_job_controller.h" 5 #include "content/browser/background_fetch/background_fetch_job_controller.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <unordered_map> 9 #include <unordered_map>
10 10
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 run_loop.QuitClosure())); 67 run_loop.QuitClosure()));
68 run_loop.Run(); 68 run_loop.Run();
69 69
70 ASSERT_EQ(error, blink::mojom::BackgroundFetchError::NONE); 70 ASSERT_EQ(error, blink::mojom::BackgroundFetchError::NONE);
71 ASSERT_GE(out_initial_requests->size(), 1u); 71 ASSERT_GE(out_initial_requests->size(), 1u);
72 ASSERT_LE(out_initial_requests->size(), 72 ASSERT_LE(out_initial_requests->size(),
73 kMaximumBackgroundFetchParallelRequests); 73 kMaximumBackgroundFetchParallelRequests);
74 74
75 // Provide fake responses for the given |request_data| pairs. 75 // Provide fake responses for the given |request_data| pairs.
76 for (const auto& pair : request_data) { 76 for (const auto& pair : request_data) {
77 CreateRequestWithProvidedResponse(pair.second, pair.first, 77 CreateRequestWithProvidedResponse(
78 200 /* status_code */, 78 pair.second, pair.first,
79 "" /* response_text */); 79 TestResponseBuilder(200 /* response_code */).Build());
80 } 80 }
81 } 81 }
82 82
83 // Creates a new BackgroundFetchJobController instance. 83 // Creates a new BackgroundFetchJobController instance.
84 std::unique_ptr<BackgroundFetchJobController> CreateJobController( 84 std::unique_ptr<BackgroundFetchJobController> CreateJobController(
85 const BackgroundFetchRegistrationId& registration_id) { 85 const BackgroundFetchRegistrationId& registration_id) {
86 StoragePartition* storage_partition = 86 StoragePartition* storage_partition =
87 BrowserContext::GetDefaultStoragePartition(browser_context()); 87 BrowserContext::GetDefaultStoragePartition(browser_context());
88 88
89 return base::MakeUnique<BackgroundFetchJobController>( 89 return base::MakeUnique<BackgroundFetchJobController>(
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 234
235 // TODO(peter): Verify that the issued download items have had their state 235 // TODO(peter): Verify that the issued download items have had their state
236 // updated to be cancelled as well. 236 // updated to be cancelled as well.
237 237
238 EXPECT_EQ(controller->state(), BackgroundFetchJobController::State::ABORTED); 238 EXPECT_EQ(controller->state(), BackgroundFetchJobController::State::ABORTED);
239 EXPECT_TRUE(did_complete_job_); 239 EXPECT_TRUE(did_complete_job_);
240 } 240 }
241 241
242 } // namespace 242 } // namespace
243 } // namespace content 243 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698