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

Side by Side Diff: chrome/browser/android/offline_pages/background_loader_offliner_unittest.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "chrome/browser/android/offline_pages/background_loader_offliner.h" 5 #include "chrome/browser/android/offline_pages/background_loader_offliner.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/test/histogram_tester.h" 9 #include "base/test/histogram_tester.h"
10 #include "base/test/scoped_mock_time_message_loop_task_runner.h" 10 #include "base/test/scoped_mock_time_message_loop_task_runner.h"
(...skipping 26 matching lines...) Expand all
37 const bool kUserRequested = true; 37 const bool kUserRequested = true;
38 38
39 // Mock OfflinePageModel for testing the SavePage calls 39 // Mock OfflinePageModel for testing the SavePage calls
40 class MockOfflinePageModel : public StubOfflinePageModel { 40 class MockOfflinePageModel : public StubOfflinePageModel {
41 public: 41 public:
42 MockOfflinePageModel() : mock_saving_(false) {} 42 MockOfflinePageModel() : mock_saving_(false) {}
43 ~MockOfflinePageModel() override {} 43 ~MockOfflinePageModel() override {}
44 44
45 void SavePage(const SavePageParams& save_page_params, 45 void SavePage(const SavePageParams& save_page_params,
46 std::unique_ptr<OfflinePageArchiver> archiver, 46 std::unique_ptr<OfflinePageArchiver> archiver,
47 const std::string& signal_data,
47 const SavePageCallback& callback) override { 48 const SavePageCallback& callback) override {
48 mock_saving_ = true; 49 mock_saving_ = true;
49 save_page_callback_ = callback; 50 save_page_callback_ = callback;
50 } 51 }
51 52
52 void CompleteSavingAsArchiveCreationFailed() { 53 void CompleteSavingAsArchiveCreationFailed() {
53 DCHECK(mock_saving_); 54 DCHECK(mock_saving_);
54 mock_saving_ = false; 55 mock_saving_ = false;
55 base::ThreadTaskRunnerHandle::Get()->PostTask( 56 base::ThreadTaskRunnerHandle::Get()->PostTask(
56 FROM_HERE, base::Bind(save_page_callback_, 57 FROM_HERE, base::Bind(save_page_callback_,
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 model()->CompleteSavingAsSuccess(); 446 model()->CompleteSavingAsSuccess();
446 PumpLoop(); 447 PumpLoop();
447 448
448 EXPECT_TRUE(completion_callback_called()); 449 EXPECT_TRUE(completion_callback_called());
449 EXPECT_EQ(Offliner::RequestStatus::SAVED, request_status()); 450 EXPECT_EQ(Offliner::RequestStatus::SAVED, request_status());
450 EXPECT_FALSE(offliner()->is_loading()); 451 EXPECT_FALSE(offliner()->is_loading());
451 EXPECT_FALSE(SaveInProgress()); 452 EXPECT_FALSE(SaveInProgress());
452 } 453 }
453 454
454 } // namespace offline_pages 455 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698