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

Unified Diff: chrome/browser/download/download_request_infobar_delegate_unittest.cc

Issue 122543002: Ensure WeakPtrFactories are at the end of their owning classes and refer (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/google/google_url_tracker.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/download_request_infobar_delegate_unittest.cc
===================================================================
--- chrome/browser/download/download_request_infobar_delegate_unittest.cc (revision 242728)
+++ chrome/browser/download/download_request_infobar_delegate_unittest.cc (working copy)
@@ -15,10 +15,10 @@
MockTabDownloadState();
virtual ~MockTabDownloadState();
- // DownloadRequestLimiter::TabDownloadState
+ // DownloadRequestLimiter::TabDownloadState:
virtual void Cancel() OVERRIDE;
virtual void Accept() OVERRIDE;
- virtual void CancelOnce() OVERRIDE { Cancel(); }
+ virtual void CancelOnce() OVERRIDE;
ConfirmInfoBarDelegate* infobar_delegate() { return infobar_delegate_.get(); }
void delete_infobar_delegate() { infobar_delegate_.reset(); }
@@ -26,9 +26,6 @@
bool accepted() const { return accepted_; }
private:
- // To produce weak pointers for infobar_ construction.
- base::WeakPtrFactory<DownloadRequestLimiter::TabDownloadState> factory_;
-
// The actual infobar delegate we're listening to.
scoped_ptr<DownloadRequestInfoBarDelegate> infobar_delegate_;
@@ -39,14 +36,18 @@
// not true.
bool accepted_;
+ // To produce weak pointers for infobar_ construction.
+ base::WeakPtrFactory<MockTabDownloadState> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(MockTabDownloadState);
};
MockTabDownloadState::MockTabDownloadState()
- : factory_(this),
- infobar_delegate_(
- DownloadRequestInfoBarDelegate::Create(factory_.GetWeakPtr())),
- responded_(false),
- accepted_(false) {
+ : responded_(false),
+ accepted_(false),
+ weak_ptr_factory_(this) {
+ infobar_delegate_ =
+ DownloadRequestInfoBarDelegate::Create(weak_ptr_factory_.GetWeakPtr());
}
MockTabDownloadState::~MockTabDownloadState() {
@@ -63,10 +64,14 @@
EXPECT_FALSE(responded_);
responded_ = true;
accepted_ = true;
- factory_.InvalidateWeakPtrs();
+ weak_ptr_factory_.InvalidateWeakPtrs();
}
+void MockTabDownloadState::CancelOnce() {
+ Cancel();
+}
+
// Tests ----------------------------------------------------------------------
TEST(DownloadRequestInfoBarDelegate, AcceptTest) {
« no previous file with comments | « no previous file | chrome/browser/google/google_url_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698