| 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 "chrome/browser/download/download_request_limiter.h" | 5 #include "chrome/browser/download/download_request_limiter.h" |
| 6 #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" | 6 #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" |
| 7 #include "chrome/test/base/testing_profile.h" | 7 #include "chrome/test/base/testing_profile.h" |
| 8 #include "content/browser/tab_contents/navigation_controller.h" | |
| 9 #include "content/browser/tab_contents/test_tab_contents.h" | 8 #include "content/browser/tab_contents/test_tab_contents.h" |
| 9 #include "content/public/browser/navigation_controller.h" |
| 10 #include "content/test/test_browser_thread.h" | 10 #include "content/test/test_browser_thread.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 12 |
| 13 using content::BrowserThread; | 13 using content::BrowserThread; |
| 14 | 14 |
| 15 class DownloadRequestLimiterTest | 15 class DownloadRequestLimiterTest |
| 16 : public TabContentsWrapperTestHarness, | 16 : public TabContentsWrapperTestHarness, |
| 17 public DownloadRequestLimiter::Callback { | 17 public DownloadRequestLimiter::Callback { |
| 18 public: | 18 public: |
| 19 DownloadRequestLimiterTest() | 19 DownloadRequestLimiterTest() |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 // And make sure we really can't download. | 193 // And make sure we really can't download. |
| 194 ask_allow_count_ = continue_count_ = cancel_count_ = 0; | 194 ask_allow_count_ = continue_count_ = cancel_count_ = 0; |
| 195 CanDownload(); | 195 CanDownload(); |
| 196 ASSERT_EQ(0, ask_allow_count_); | 196 ASSERT_EQ(0, ask_allow_count_); |
| 197 ASSERT_EQ(0, continue_count_); | 197 ASSERT_EQ(0, continue_count_); |
| 198 ASSERT_EQ(1, cancel_count_); | 198 ASSERT_EQ(1, cancel_count_); |
| 199 // And the state shouldn't have changed. | 199 // And the state shouldn't have changed. |
| 200 ASSERT_EQ(DownloadRequestLimiter::DOWNLOADS_NOT_ALLOWED, | 200 ASSERT_EQ(DownloadRequestLimiter::DOWNLOADS_NOT_ALLOWED, |
| 201 download_request_limiter_->GetDownloadStatus(contents())); | 201 download_request_limiter_->GetDownloadStatus(contents())); |
| 202 } | 202 } |
| OLD | NEW |