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

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

Issue 2890853002: Downloads: replace BrowserThread::FILE with task scheduler. (Closed)
Patch Set: Add a missing mock expectation. Created 3 years, 6 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"
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
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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 base::ThreadRestrictions::ScopedAllowIO allow_io_for_content_verification; 718 base::ThreadRestrictions::ScopedAllowIO allow_io_for_content_verification;
719 ASSERT_TRUE(base::ReadFileToString(path, &mhtml)); 719 ASSERT_TRUE(base::ReadFileToString(path, &mhtml));
720 } 720 }
721 721
722 // Make sure that both extra data parts made it into the mhtml. 722 // Make sure that both extra data parts made it into the mhtml.
723 EXPECT_THAT(mhtml, HasSubstr(kFakeSignalData1)); 723 EXPECT_THAT(mhtml, HasSubstr(kFakeSignalData1));
724 EXPECT_THAT(mhtml, HasSubstr(kFakeSignalData2)); 724 EXPECT_THAT(mhtml, HasSubstr(kFakeSignalData2));
725 } 725 }
726 726
727 } // namespace content 727 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698