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

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

Issue 275011: Make the multiple download request dialog an infobar.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/download/download_request_infobar_delegate.h"
6 #include "chrome/browser/download/download_request_manager.h"
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 class MockTabDownloadState : public DownloadRequestManager::TabDownloadState {
10 public:
11 MockTabDownloadState() : responded_(false), accepted_(false) {
12 }
13
14 virtual ~MockTabDownloadState() {
15 EXPECT_TRUE(responded_);
16 }
17
18 virtual void Accept() {
19 EXPECT_FALSE(responded_);
20 responded_ = true;
21 accepted_ = true;
22 }
23
24 virtual void Cancel() {
25 EXPECT_FALSE(responded_);
26 responded_ = true;
27 accepted_ = false;
28 }
29
30 bool responded() {
31 return responded_;
32 }
33
34 bool accepted() {
35 return responded_ && accepted_;
36 }
37
38 private:
39 // True if we have gotten some sort of response.
40 bool responded_;
41
42 // True if we have gotten a Accept response. Meaningless if |responded_| is
43 // not true.
44 bool accepted_;
45 };
46
47 TEST(DownloadRequestInfobar, AcceptTest) {
48 MockTabDownloadState state;
49 DownloadRequestInfoBarDelegate infobar(NULL, &state);
50 infobar.Accept();
51 EXPECT_TRUE(state.accepted());
52 }
53
54 TEST(DownloadRequestInfobar, CancelTest) {
55 MockTabDownloadState state;
56 DownloadRequestInfoBarDelegate infobar(NULL, &state);
57 infobar.Cancel();
58 EXPECT_FALSE(state.accepted());
59 }
60
61 TEST(DownloadRequestInfobar, CloseTest) {
62 MockTabDownloadState state;
63 DownloadRequestInfoBarDelegate infobar(NULL, &state);
64 infobar.InfoBarClosed();
65 EXPECT_FALSE(state.accepted());
66 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_request_infobar_delegate.cc ('k') | chrome/browser/download/download_request_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698