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 <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" |
11 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
12 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "base/test/histogram_tester.h" | 16 #include "base/test/histogram_tester.h" |
17 #include "base/threading/thread_restrictions.h" | 17 #include "base/threading/thread_restrictions.h" |
| 18 #include "content/browser/download/download_task_runner.h" |
18 #include "content/browser/renderer_host/render_process_host_impl.h" | 19 #include "content/browser/renderer_host/render_process_host_impl.h" |
19 #include "content/common/frame_messages.h" | 20 #include "content/common/frame_messages.h" |
20 #include "content/public/browser/mhtml_extra_parts.h" | 21 #include "content/public/browser/mhtml_extra_parts.h" |
21 #include "content/public/browser/render_frame_host.h" | 22 #include "content/public/browser/render_frame_host.h" |
22 #include "content/public/browser/render_process_host.h" | 23 #include "content/public/browser/render_process_host.h" |
23 #include "content/public/browser/web_contents.h" | 24 #include "content/public/browser/web_contents.h" |
24 #include "content/public/common/mhtml_generation_params.h" | 25 #include "content/public/common/mhtml_generation_params.h" |
25 #include "content/public/test/browser_test_utils.h" | 26 #include "content/public/test/browser_test_utils.h" |
26 #include "content/public/test/content_browser_test.h" | 27 #include "content/public/test/content_browser_test.h" |
27 #include "content/public/test/content_browser_test_utils.h" | 28 #include "content/public/test/content_browser_test_utils.h" |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 BrowserThread::PostTask( | 330 BrowserThread::PostTask( |
330 BrowserThread::UI, FROM_HERE, base::Bind( | 331 BrowserThread::UI, FROM_HERE, base::Bind( |
331 &GenerateMHTMLAndExitRendererMessageFilter::TaskX, | 332 &GenerateMHTMLAndExitRendererMessageFilter::TaskX, |
332 base::Unretained(this))); | 333 base::Unretained(this))); |
333 } | 334 } |
334 | 335 |
335 return false; | 336 return false; |
336 }; | 337 }; |
337 | 338 |
338 void TaskX() { | 339 void TaskX() { |
339 BrowserThread::PostTask( | 340 GetDownloadTaskRunner()->PostTask( |
340 BrowserThread::FILE, FROM_HERE, base::Bind( | 341 FROM_HERE, base::Bind(&GenerateMHTMLAndExitRendererMessageFilter::TaskY, |
341 &GenerateMHTMLAndExitRendererMessageFilter::TaskY, | 342 base::Unretained(this))); |
342 base::Unretained(this))); | |
343 } | 343 } |
344 | 344 |
345 void TaskY() { | 345 void TaskY() { |
346 BrowserThread::PostTask( | 346 BrowserThread::PostTask( |
347 BrowserThread::UI, FROM_HERE, base::Bind( | 347 BrowserThread::UI, FROM_HERE, base::Bind( |
348 &GenerateMHTMLAndExitRendererMessageFilter::TaskZ, | 348 &GenerateMHTMLAndExitRendererMessageFilter::TaskZ, |
349 base::Unretained(this))); | 349 base::Unretained(this))); |
350 } | 350 } |
351 | 351 |
352 void TaskZ() { | 352 void TaskZ() { |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 base::ThreadRestrictions::ScopedAllowIO allow_io_for_content_verification; | 724 base::ThreadRestrictions::ScopedAllowIO allow_io_for_content_verification; |
725 ASSERT_TRUE(base::ReadFileToString(path, &mhtml)); | 725 ASSERT_TRUE(base::ReadFileToString(path, &mhtml)); |
726 } | 726 } |
727 | 727 |
728 // Make sure that both extra data parts made it into the mhtml. | 728 // Make sure that both extra data parts made it into the mhtml. |
729 EXPECT_THAT(mhtml, HasSubstr(kFakeSignalData1)); | 729 EXPECT_THAT(mhtml, HasSubstr(kFakeSignalData1)); |
730 EXPECT_THAT(mhtml, HasSubstr(kFakeSignalData2)); | 730 EXPECT_THAT(mhtml, HasSubstr(kFakeSignalData2)); |
731 } | 731 } |
732 | 732 |
733 } // namespace content | 733 } // namespace content |
OLD | NEW |