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

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

Issue 2683493002: Get signals working in the EXTRA_DATA section of MHTML (Closed)
Patch Set: FIx tests, add unit test Created 3 years, 9 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 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 { 665 {
666 base::ThreadRestrictions::ScopedAllowIO allow_io_for_content_verification; 666 base::ThreadRestrictions::ScopedAllowIO allow_io_for_content_verification;
667 ASSERT_TRUE(base::ReadFileToString(path, &mhtml)); 667 ASSERT_TRUE(base::ReadFileToString(path, &mhtml));
668 } 668 }
669 669
670 // Make sure the overlay is removed. 670 // Make sure the overlay is removed.
671 EXPECT_THAT(mhtml, Not(HasSubstr("class=3D\"overlay"))); 671 EXPECT_THAT(mhtml, Not(HasSubstr("class=3D\"overlay")));
672 EXPECT_THAT(mhtml, Not(HasSubstr("class=3D\"modal"))); 672 EXPECT_THAT(mhtml, Not(HasSubstr("class=3D\"modal")));
673 } 673 }
674 674
675 IN_PROC_BROWSER_TEST_F(MHTMLGenerationSitePerProcessTest,
676 GenerateMHTMLWithExtraData) {
677 const char kFakeSignalData = "FakeSignalData";
678 base::FilePath path(temp_dir_.GetPath());
679 path = path.Append(FILE_PATH_LITERAL("test.mht"));
680
681 GURL url(embedded_test_server()->GetURL("/page_with_image.html"));
682
683 MHTMLGenerationParams params(path);
684 params.remove_popup_overlay = true;
685 params.extra_data = kFakeSignalData;
686
687 GenerateMHTML(params, url);
688 ASSERT_FALSE(HasFailure());
689
690 std::string mhtml;
691 {
692 base::ThreadRestrictions::ScopedAllowIO allow_io_for_content_verification;
693 ASSERT_TRUE(base::ReadFileToString(path, &mhtml));
694 }
695
696 // Make sure that extra data made it into the mhtml.
697 EXPECT_THAT(mhtml, HasSubstr(kFakeSignalData));
698 }
699
700
675 } // namespace content 701 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698