OLD | NEW |
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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/callback.h" | 6 #include "base/callback.h" |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 file_size_ = size; | 60 file_size_ = size; |
61 quit_closure.Run(); | 61 quit_closure.Run(); |
62 } | 62 } |
63 | 63 |
64 bool has_mhtml_callback_run_; | 64 bool has_mhtml_callback_run_; |
65 int64 file_size_; | 65 int64 file_size_; |
66 }; | 66 }; |
67 | 67 |
68 // Tests that generating a MHTML does create contents. | 68 // Tests that generating a MHTML does create contents. |
69 // Note that the actual content of the file is not tested, the purpose of this | 69 // Note that the actual content of the file is not tested, the purpose of this |
70 // test is to ensure we were successfull in creating the MHTML data from the | 70 // test is to ensure we were successful in creating the MHTML data from the |
71 // renderer. | 71 // renderer. |
72 IN_PROC_BROWSER_TEST_F(MHTMLGenerationTest, GenerateMHTML) { | 72 IN_PROC_BROWSER_TEST_F(MHTMLGenerationTest, GenerateMHTML) { |
73 base::FilePath path(temp_dir_.path()); | 73 base::FilePath path(temp_dir_.path()); |
74 path = path.Append(FILE_PATH_LITERAL("test.mht")); | 74 path = path.Append(FILE_PATH_LITERAL("test.mht")); |
75 | 75 |
76 GenerateMHTML(path, embedded_test_server()->GetURL("/simple_page.html")); | 76 GenerateMHTML(path, embedded_test_server()->GetURL("/simple_page.html")); |
77 ASSERT_FALSE(HasFailure()); | 77 ASSERT_FALSE(HasFailure()); |
78 | 78 |
79 // Make sure the actual generated file has some contents. | 79 // Make sure the actual generated file has some contents. |
80 EXPECT_GT(file_size(), 0); // Verify the size reported by the callback. | 80 EXPECT_GT(file_size(), 0); // Verify the size reported by the callback. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 141 |
142 // Make sure that URLs of both frames are present | 142 // Make sure that URLs of both frames are present |
143 // (note that these are single-line regexes). | 143 // (note that these are single-line regexes). |
144 EXPECT_THAT( | 144 EXPECT_THAT( |
145 mhtml, | 145 mhtml, |
146 ContainsRegex("Content-Location:.*/frame_tree/page_with_one_frame.html")); | 146 ContainsRegex("Content-Location:.*/frame_tree/page_with_one_frame.html")); |
147 EXPECT_THAT(mhtml, ContainsRegex("Content-Location:.*/title1.html")); | 147 EXPECT_THAT(mhtml, ContainsRegex("Content-Location:.*/title1.html")); |
148 } | 148 } |
149 | 149 |
150 } // namespace content | 150 } // namespace content |
OLD | NEW |