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

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

Issue 2805813006: Set the Content-Type and Content-Length headers for BG Fetch (Closed)
Patch Set: Set the Content-Type and Content-Length headers for BG Fetch 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 <map> 5 #include <map>
6 #include <memory> 6 #include <memory>
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 embedded_worker_test_helper()->last_fetches().value(); 362 embedded_worker_test_helper()->last_fetches().value();
363 ASSERT_EQ(fetches.size(), requests.size()); 363 ASSERT_EQ(fetches.size(), requests.size());
364 364
365 for (size_t i = 0; i < fetches.size(); ++i) { 365 for (size_t i = 0; i < fetches.size(); ++i) {
366 ASSERT_EQ(fetches[i].request.url, requests[i].url); 366 ASSERT_EQ(fetches[i].request.url, requests[i].url);
367 EXPECT_EQ(fetches[i].request.method, requests[i].method); 367 EXPECT_EQ(fetches[i].request.method, requests[i].method);
368 368
369 EXPECT_EQ(fetches[i].request.url, fetches[i].response.url_list[0]); 369 EXPECT_EQ(fetches[i].request.url, fetches[i].response.url_list[0]);
370 370
371 // TODO(peter): change-detector tests for unsupported properties. 371 // TODO(peter): change-detector tests for unsupported properties.
372 EXPECT_EQ(fetches[i].response.status_code, 0); 372 EXPECT_EQ(fetches[i].response.status_code, 200);
373 EXPECT_TRUE(fetches[i].response.status_text.empty()); 373 EXPECT_TRUE(fetches[i].response.status_text.empty());
374 EXPECT_EQ(fetches[i].response.response_type, 374 EXPECT_EQ(fetches[i].response.response_type,
375 blink::WebServiceWorkerResponseTypeDefault); 375 blink::WebServiceWorkerResponseTypeDefault);
376 EXPECT_TRUE(fetches[i].response.headers.empty()); 376 EXPECT_FALSE(fetches[i].response.headers.empty());
377 EXPECT_EQ(fetches[i].response.error, 377 EXPECT_EQ(fetches[i].response.error,
378 blink::WebServiceWorkerResponseErrorUnknown); 378 blink::WebServiceWorkerResponseErrorUnknown);
379 379
380 // Verify that all properties have a sensible value. 380 // Verify that all properties have a sensible value.
381 EXPECT_FALSE(fetches[i].response.response_time.is_null()); 381 EXPECT_FALSE(fetches[i].response.response_time.is_null());
382 382
383 // Verify that the response blobs have been populated. We cannot consume 383 // Verify that the response blobs have been populated. We cannot consume
384 // their data here since the handles have already been released. 384 // their data here since the handles have already been released.
385 ASSERT_FALSE(fetches[i].response.blob_uuid.empty()); 385 ASSERT_FALSE(fetches[i].response.blob_uuid.empty());
386 ASSERT_GT(fetches[i].response.blob_size, 0u); 386 ASSERT_GT(fetches[i].response.blob_size, 0u);
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 const bool has_alternative_tag = 525 const bool has_alternative_tag =
526 tags[0] == kAlternativeTag || tags[1] == kAlternativeTag; 526 tags[0] == kAlternativeTag || tags[1] == kAlternativeTag;
527 527
528 EXPECT_TRUE(has_example_tag); 528 EXPECT_TRUE(has_example_tag);
529 EXPECT_TRUE(has_alternative_tag); 529 EXPECT_TRUE(has_alternative_tag);
530 } 530 }
531 } 531 }
532 532
533 } // namespace 533 } // namespace
534 } // namespace content 534 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698