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

Side by Side Diff: chrome/browser/android/offline_pages/background_loader_offliner_unittest.cc

Issue 2779983005: [Offline pages] Fix crashing snapshot controller and reorganize reset code for easier test maintena… (Closed)
Patch Set: rebase Created 3 years, 7 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
« no previous file with comments | « chrome/browser/android/offline_pages/background_loader_offliner.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_feature_list.h" 10 #include "base/test/scoped_feature_list.h"
(...skipping 26 matching lines...) Expand all
37 const int64_t kRequestId = 7; 37 const int64_t kRequestId = 7;
38 const GURL kHttpUrl("http://www.tunafish.com"); 38 const GURL kHttpUrl("http://www.tunafish.com");
39 const GURL kFileUrl("file://salmon.png"); 39 const GURL kFileUrl("file://salmon.png");
40 const ClientId kClientId("async_loading", "88"); 40 const ClientId kClientId("async_loading", "88");
41 const bool kUserRequested = true; 41 const bool kUserRequested = true;
42 42
43 // Mock OfflinePageModel for testing the SavePage calls 43 // Mock OfflinePageModel for testing the SavePage calls
44 class MockOfflinePageModel : public StubOfflinePageModel { 44 class MockOfflinePageModel : public StubOfflinePageModel {
45 public: 45 public:
46 MockOfflinePageModel() : mock_saving_(false), mock_deleting_(false) {} 46 MockOfflinePageModel() : mock_saving_(false), mock_deleting_(false) {}
47 ~MockOfflinePageModel() override {} 47 ~MockOfflinePageModel() override {
48 DVLOG(0) << "Offline page model destroyed";
49 }
48 50
49 void SavePage(const SavePageParams& save_page_params, 51 void SavePage(const SavePageParams& save_page_params,
50 std::unique_ptr<OfflinePageArchiver> archiver, 52 std::unique_ptr<OfflinePageArchiver> archiver,
51 const SavePageCallback& callback) override { 53 const SavePageCallback& callback) override {
52 mock_saving_ = true; 54 mock_saving_ = true;
53 save_page_callback_ = callback; 55 save_page_callback_ = callback;
54 } 56 }
55 57
56 void CompleteSavingAsArchiveCreationFailed() { 58 void CompleteSavingAsArchiveCreationFailed() {
57 DCHECK(mock_saving_); 59 DCHECK(mock_saving_);
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 CompleteLoading(); 642 CompleteLoading();
641 PumpLoop(); 643 PumpLoop();
642 644
643 // One extra part should be added if the flag is on. 645 // One extra part should be added if the flag is on.
644 content::MHTMLExtraParts* extra_parts = 646 content::MHTMLExtraParts* extra_parts =
645 content::MHTMLExtraParts::FromWebContents(offliner()->web_contents()); 647 content::MHTMLExtraParts::FromWebContents(offliner()->web_contents());
646 EXPECT_EQ(extra_parts->size(), 1); 648 EXPECT_EQ(extra_parts->size(), 1);
647 } 649 }
648 650
649 } // namespace offline_pages 651 } // namespace offline_pages
OLDNEW
« no previous file with comments | « chrome/browser/android/offline_pages/background_loader_offliner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698