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

Side by Side Diff: chrome/browser/download/download_request_infobar_delegate_unittest.cc

Issue 8698016: Remove InfoBarDelegate::InfoBarClosed(), delete InfoBars directly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cancelling changes. Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "chrome/browser/download/download_request_infobar_delegate.h" 6 #include "chrome/browser/download/download_request_infobar_delegate.h"
7 #include "chrome/browser/download/download_request_limiter.h" 7 #include "chrome/browser/download/download_request_limiter.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 // MockTabDownloadState ------------------------------------------------------- 10 // MockTabDownloadState -------------------------------------------------------
11 11
12 class MockTabDownloadState : public DownloadRequestLimiter::TabDownloadState { 12 class MockTabDownloadState : public DownloadRequestLimiter::TabDownloadState {
13 public: 13 public:
14 MockTabDownloadState(); 14 MockTabDownloadState();
15 virtual ~MockTabDownloadState(); 15 virtual ~MockTabDownloadState();
16 16
17 // DownloadRequestLimiter::TabDownloadState 17 // DownloadRequestLimiter::TabDownloadState
18 virtual void Cancel(); 18 virtual void Cancel();
19 virtual void Accept(); 19 virtual void Accept();
20 20
21 ConfirmInfoBarDelegate* infobar() { 21 ConfirmInfoBarDelegate* infobar() {
22 return infobar_->AsConfirmInfoBarDelegate(); 22 return infobar_->AsConfirmInfoBarDelegate();
23 } 23 }
24 void close_infobar() { 24 void close_infobar() {
25 // TODO(pkasting): Right now InfoBarDelegates delete themselves via 25 infobar_.reset(NULL);
26 // InfoBarClosed(); once InfoBars own their delegates, this can become a
27 // simple reset() call and ~MockTabDownloadState() will no longer need to
28 // call it.
29 if (infobar_ != NULL)
30 infobar_.release()->InfoBarClosed();
31 } 26 }
32 bool responded() const { return responded_; } 27 bool responded() const { return responded_; }
33 bool accepted() const { return accepted_; } 28 bool accepted() const { return accepted_; }
34 29
35 private: 30 private:
36 // The actual infobar delegate we're listening to. 31 // The actual infobar delegate we're listening to.
37 scoped_ptr<InfoBarDelegate> infobar_; 32 scoped_ptr<InfoBarDelegate> infobar_;
38 33
39 // True if we have gotten some sort of response. 34 // True if we have gotten some sort of response.
40 bool responded_; 35 bool responded_;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 if (state.infobar()->Cancel()) 77 if (state.infobar()->Cancel())
83 state.close_infobar(); 78 state.close_infobar();
84 EXPECT_FALSE(state.accepted()); 79 EXPECT_FALSE(state.accepted());
85 } 80 }
86 81
87 TEST(DownloadRequestInfobarDelegate, CloseTest) { 82 TEST(DownloadRequestInfobarDelegate, CloseTest) {
88 MockTabDownloadState state; 83 MockTabDownloadState state;
89 state.close_infobar(); 84 state.close_infobar();
90 EXPECT_FALSE(state.accepted()); 85 EXPECT_FALSE(state.accepted());
91 } 86 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698