| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/browser_thread.h" | 5 #include "chrome/browser/browser_thread.h" |
| 6 #include "chrome/browser/download/download_request_limiter.h" | 6 #include "chrome/browser/download/download_request_limiter.h" |
| 7 #include "chrome/browser/renderer_host/test/test_render_view_host.h" | |
| 8 #include "chrome/browser/tab_contents/navigation_controller.h" | |
| 9 #include "chrome/test/testing_profile.h" | 7 #include "chrome/test/testing_profile.h" |
| 8 #include "content/browser/renderer_host/test_render_view_host.h" |
| 9 #include "content/browser/tab_contents/navigation_controller.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 class DownloadRequestLimiterTest | 12 class DownloadRequestLimiterTest |
| 13 : public RenderViewHostTestHarness, | 13 : public RenderViewHostTestHarness, |
| 14 public DownloadRequestLimiter::Callback { | 14 public DownloadRequestLimiter::Callback { |
| 15 public: | 15 public: |
| 16 DownloadRequestLimiterTest() : io_thread_(BrowserThread::IO, &message_loop_) { | 16 DownloadRequestLimiterTest() : io_thread_(BrowserThread::IO, &message_loop_) { |
| 17 } | 17 } |
| 18 | 18 |
| 19 virtual void SetUp() { | 19 virtual void SetUp() { |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 ask_allow_count_ = continue_count_ = cancel_count_ = 0; | 205 ask_allow_count_ = continue_count_ = cancel_count_ = 0; |
| 206 CanDownload(); | 206 CanDownload(); |
| 207 ASSERT_EQ(0, ask_allow_count_); | 207 ASSERT_EQ(0, ask_allow_count_); |
| 208 ASSERT_EQ(0, continue_count_); | 208 ASSERT_EQ(0, continue_count_); |
| 209 ASSERT_EQ(1, cancel_count_); | 209 ASSERT_EQ(1, cancel_count_); |
| 210 // And the state shouldn't have changed. | 210 // And the state shouldn't have changed. |
| 211 ASSERT_EQ(DownloadRequestLimiter::DOWNLOADS_NOT_ALLOWED, | 211 ASSERT_EQ(DownloadRequestLimiter::DOWNLOADS_NOT_ALLOWED, |
| 212 download_request_limiter_->GetDownloadStatus( | 212 download_request_limiter_->GetDownloadStatus( |
| 213 controller().tab_contents())); | 213 controller().tab_contents())); |
| 214 } | 214 } |
| OLD | NEW |