| OLD | NEW |
| 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 ------------------------------------------------------- |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 responded_ = true; | 65 responded_ = true; |
| 66 accepted_ = true; | 66 accepted_ = true; |
| 67 static_cast<DownloadRequestInfoBarDelegate*>(infobar_.get())->set_host(NULL); | 67 static_cast<DownloadRequestInfoBarDelegate*>(infobar_.get())->set_host(NULL); |
| 68 } | 68 } |
| 69 | 69 |
| 70 | 70 |
| 71 // Tests ---------------------------------------------------------------------- | 71 // Tests ---------------------------------------------------------------------- |
| 72 | 72 |
| 73 TEST(DownloadRequestInfobarDelegate, AcceptTest) { | 73 TEST(DownloadRequestInfobarDelegate, AcceptTest) { |
| 74 MockTabDownloadState state; | 74 MockTabDownloadState state; |
| 75 state.infobar()->Accept(); | 75 if (state.infobar()->Accept()) |
| 76 state.close_infobar(); |
| 76 EXPECT_TRUE(state.accepted()); | 77 EXPECT_TRUE(state.accepted()); |
| 77 } | 78 } |
| 78 | 79 |
| 79 TEST(DownloadRequestInfobarDelegate, CancelTest) { | 80 TEST(DownloadRequestInfobarDelegate, CancelTest) { |
| 80 MockTabDownloadState state; | 81 MockTabDownloadState state; |
| 81 state.infobar()->Cancel(); | 82 if (state.infobar()->Cancel()) |
| 83 state.close_infobar(); |
| 82 EXPECT_FALSE(state.accepted()); | 84 EXPECT_FALSE(state.accepted()); |
| 83 } | 85 } |
| 84 | 86 |
| 85 TEST(DownloadRequestInfobarDelegate, CloseTest) { | 87 TEST(DownloadRequestInfobarDelegate, CloseTest) { |
| 86 MockTabDownloadState state; | 88 MockTabDownloadState state; |
| 87 state.close_infobar(); | 89 state.close_infobar(); |
| 88 EXPECT_FALSE(state.accepted()); | 90 EXPECT_FALSE(state.accepted()); |
| 89 } | 91 } |
| OLD | NEW |