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

Side by Side Diff: chrome/browser/extensions/content_verifier_browsertest.cc

Issue 2771953003: Fix content verification code for undreadable and deleted files. (Closed)
Patch Set: . 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <list> 5 #include <list>
6 #include <set> 6 #include <set>
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 119
120 // Helper for forcing ContentVerifyJob's to return an error. 120 // Helper for forcing ContentVerifyJob's to return an error.
121 class JobDelegate : public ContentVerifyJob::TestDelegate { 121 class JobDelegate : public ContentVerifyJob::TestDelegate {
122 public: 122 public:
123 JobDelegate() 123 JobDelegate()
124 : fail_next_read_(false), 124 : fail_next_read_(false),
125 fail_next_done_(false), 125 fail_next_done_(false),
126 bytes_read_failed_(0), 126 bytes_read_failed_(0),
127 done_reading_failed_(0) {} 127 done_reading_failed_(0) {}
128 128
129 virtual ~JobDelegate() {} 129 ~JobDelegate() override {}
130 130
131 void set_id(const ExtensionId& id) { id_ = id; } 131 void set_id(const ExtensionId& id) { id_ = id; }
132 void fail_next_read() { fail_next_read_ = true; } 132 void fail_next_read() { fail_next_read_ = true; }
133 void fail_next_done() { fail_next_done_ = true; } 133 void fail_next_done() { fail_next_done_ = true; }
134 134
135 // Return the number of BytesRead/DoneReading calls we actually failed, 135 // Return the number of BytesRead/DoneReading calls we actually failed,
136 // respectively. 136 // respectively.
137 int bytes_read_failed() { return bytes_read_failed_; } 137 int bytes_read_failed() { return bytes_read_failed_; }
138 int done_reading_failed() { return done_reading_failed_; } 138 int done_reading_failed() { return done_reading_failed_; }
139 139
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 // Assert that the first reinstall action happened with a delay of 0, and 827 // Assert that the first reinstall action happened with a delay of 0, and
828 // then kept growing each additional time. 828 // then kept growing each additional time.
829 ASSERT_EQ(iterations, calls.size()); 829 ASSERT_EQ(iterations, calls.size());
830 EXPECT_EQ(base::TimeDelta(), delay_tracker.calls()[0]); 830 EXPECT_EQ(base::TimeDelta(), delay_tracker.calls()[0]);
831 for (size_t i = 1; i < delay_tracker.calls().size(); i++) { 831 for (size_t i = 1; i < delay_tracker.calls().size(); i++) {
832 EXPECT_LT(calls[i - 1], calls[i]); 832 EXPECT_LT(calls[i - 1], calls[i]);
833 } 833 }
834 } 834 }
835 835
836 } // namespace extensions 836 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698