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

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

Issue 2683493002: Get signals working in the EXTRA_DATA section of MHTML (Closed)
Patch Set: Approach for writing to the file afterwards instead. 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/prerendering_offliner.h" 5 #include "chrome/browser/android/offline_pages/prerendering_offliner.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 std::unique_ptr<OfflinePageArchiver> archiver, 125 std::unique_ptr<OfflinePageArchiver> archiver,
126 const SavePageCallback& callback) override { 126 const SavePageCallback& callback) override {
127 mock_saving_ = true; 127 mock_saving_ = true;
128 save_page_callback_ = callback; 128 save_page_callback_ = callback;
129 } 129 }
130 130
131 void CompleteSavingAsArchiveCreationFailed() { 131 void CompleteSavingAsArchiveCreationFailed() {
132 DCHECK(mock_saving_); 132 DCHECK(mock_saving_);
133 mock_saving_ = false; 133 mock_saving_ = false;
134 base::ThreadTaskRunnerHandle::Get()->PostTask( 134 base::ThreadTaskRunnerHandle::Get()->PostTask(
135 FROM_HERE, base::Bind(save_page_callback_, 135 FROM_HERE,
136 SavePageResult::ARCHIVE_CREATION_FAILED, 0)); 136 base::Bind(save_page_callback_, SavePageResult::ARCHIVE_CREATION_FAILED,
137 0, base::FilePath()));
137 } 138 }
138 139
139 void CompleteSavingAsSuccess() { 140 void CompleteSavingAsSuccess() {
140 DCHECK(mock_saving_); 141 DCHECK(mock_saving_);
141 mock_saving_ = false; 142 mock_saving_ = false;
142 base::ThreadTaskRunnerHandle::Get()->PostTask( 143 base::ThreadTaskRunnerHandle::Get()->PostTask(
143 FROM_HERE, 144 FROM_HERE, base::Bind(save_page_callback_, SavePageResult::SUCCESS,
144 base::Bind(save_page_callback_, SavePageResult::SUCCESS, 123456)); 145 123456, base::FilePath()));
145 } 146 }
146 147
147 bool mock_saving() const { return mock_saving_; } 148 bool mock_saving() const { return mock_saving_; }
148 149
149 private: 150 private:
150 bool mock_saving_; 151 bool mock_saving_;
151 SavePageCallback save_page_callback_; 152 SavePageCallback save_page_callback_;
152 153
153 DISALLOW_COPY_AND_ASSIGN(MockOfflinePageModel); 154 DISALLOW_COPY_AND_ASSIGN(MockOfflinePageModel);
154 }; 155 };
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 base::Time creation_time = base::Time::Now(); 479 base::Time creation_time = base::Time::Now();
479 SavePageRequest request(kRequestId, kHttpUrl, kClientId, creation_time, 480 SavePageRequest request(kRequestId, kHttpUrl, kClientId, creation_time,
480 kUserRequested); 481 kUserRequested);
481 EXPECT_TRUE(offliner()->LoadAndSave(request, callback())); 482 EXPECT_TRUE(offliner()->LoadAndSave(request, callback()));
482 loader()->set_is_lowbar_met(true); 483 loader()->set_is_lowbar_met(true);
483 EXPECT_FALSE(offliner()->HandleTimeout(request)); 484 EXPECT_FALSE(offliner()->HandleTimeout(request));
484 EXPECT_FALSE(loader()->start_snapshot_called()); 485 EXPECT_FALSE(loader()->start_snapshot_called());
485 } 486 }
486 487
487 } // namespace offline_pages 488 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698