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

Side by Side Diff: content/browser/download/mhtml_generation_browsertest.cc

Issue 2827503002: Add extra headers argument so we don't pass headers in the body. (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 (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 <stdint.h> 5 #include <stdint.h>
6 #include <memory> 6 #include <memory>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 const char kFakeContentLocation[] = 680 const char kFakeContentLocation[] =
681 "cid:signal-data-62691-645341c4-62b3-478e-a8c5-e0dfccc3ca02@mhtml.blink"; 681 "cid:signal-data-62691-645341c4-62b3-478e-a8c5-e0dfccc3ca02@mhtml.blink";
682 base::FilePath path(temp_dir_.GetPath()); 682 base::FilePath path(temp_dir_.GetPath());
683 path = path.Append(FILE_PATH_LITERAL("test.mht")); 683 path = path.Append(FILE_PATH_LITERAL("test.mht"));
684 GURL url(embedded_test_server()->GetURL("/page_with_image.html")); 684 GURL url(embedded_test_server()->GetURL("/page_with_image.html"));
685 MHTMLGenerationParams params(path); 685 MHTMLGenerationParams params(path);
686 686
687 // Place the extra data we need into the web contents user data. 687 // Place the extra data we need into the web contents user data.
688 std::string content_type(kFakeContentType); 688 std::string content_type(kFakeContentType);
689 std::string content_location(kFakeContentLocation); 689 std::string content_location(kFakeContentLocation);
690 std::string extra_headers;
690 691
691 // Get the MHTMLExtraParts 692 // Get the MHTMLExtraParts
692 MHTMLExtraParts* extra_parts = 693 MHTMLExtraParts* extra_parts =
693 MHTMLExtraParts::FromWebContents(shell()->web_contents()); 694 MHTMLExtraParts::FromWebContents(shell()->web_contents());
694 695
695 // Add two extra data parts to the MHTML. 696 // Add two extra data parts to the MHTML.
696 extra_parts->AddExtraMHTMLPart(content_type, content_location, 697 extra_parts->AddExtraMHTMLPart(content_type, content_location, extra_headers,
697 kFakeSignalData1); 698 kFakeSignalData1);
698 extra_parts->AddExtraMHTMLPart(content_type, content_location, 699 extra_parts->AddExtraMHTMLPart(content_type, content_location, extra_headers,
699 kFakeSignalData2); 700 kFakeSignalData2);
700 EXPECT_EQ(extra_parts->size(), 2); 701 EXPECT_EQ(extra_parts->size(), 2);
701 GenerateMHTML(params, url); 702 GenerateMHTML(params, url);
702 703
703 EXPECT_TRUE(has_mhtml_callback_run()); 704 EXPECT_TRUE(has_mhtml_callback_run());
704 705
705 std::string mhtml; 706 std::string mhtml;
706 { 707 {
707 base::ThreadRestrictions::ScopedAllowIO allow_io_for_content_verification; 708 base::ThreadRestrictions::ScopedAllowIO allow_io_for_content_verification;
708 ASSERT_TRUE(base::ReadFileToString(path, &mhtml)); 709 ASSERT_TRUE(base::ReadFileToString(path, &mhtml));
709 } 710 }
710 711
711 // Make sure that both extra data parts made it into the mhtml. 712 // Make sure that both extra data parts made it into the mhtml.
712 EXPECT_THAT(mhtml, HasSubstr(kFakeSignalData1)); 713 EXPECT_THAT(mhtml, HasSubstr(kFakeSignalData1));
713 EXPECT_THAT(mhtml, HasSubstr(kFakeSignalData2)); 714 EXPECT_THAT(mhtml, HasSubstr(kFakeSignalData2));
714 } 715 }
715 716
716 } // namespace content 717 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/mhtml_extra_parts_impl.cc ('k') | content/browser/download/mhtml_generation_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698