OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 5 #include "base/bind.h" |
6 #include "chrome/browser/download/download_request_limiter.h" | 6 #include "chrome/browser/download/download_request_limiter.h" |
7 #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" | 7 #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" |
8 #include "chrome/test/base/testing_profile.h" | 8 #include "chrome/test/base/testing_profile.h" |
9 #include "content/browser/tab_contents/test_tab_contents.h" | |
10 #include "content/public/browser/navigation_controller.h" | 9 #include "content/public/browser/navigation_controller.h" |
11 #include "content/test/test_browser_thread.h" | 10 #include "content/test/test_browser_thread.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
13 | 12 |
14 using content::BrowserThread; | 13 using content::BrowserThread; |
15 | 14 |
16 class DownloadRequestLimiterTest : public TabContentsWrapperTestHarness { | 15 class DownloadRequestLimiterTest : public TabContentsWrapperTestHarness { |
17 public: | 16 public: |
18 DownloadRequestLimiterTest() | 17 DownloadRequestLimiterTest() |
19 : ui_thread_(BrowserThread::UI, &message_loop_), | 18 : ui_thread_(BrowserThread::UI, &message_loop_), |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 // And make sure we really can't download. | 200 // And make sure we really can't download. |
202 ask_allow_count_ = continue_count_ = cancel_count_ = 0; | 201 ask_allow_count_ = continue_count_ = cancel_count_ = 0; |
203 CanDownload(); | 202 CanDownload(); |
204 ASSERT_EQ(0, ask_allow_count_); | 203 ASSERT_EQ(0, ask_allow_count_); |
205 ASSERT_EQ(0, continue_count_); | 204 ASSERT_EQ(0, continue_count_); |
206 ASSERT_EQ(1, cancel_count_); | 205 ASSERT_EQ(1, cancel_count_); |
207 // And the state shouldn't have changed. | 206 // And the state shouldn't have changed. |
208 ASSERT_EQ(DownloadRequestLimiter::DOWNLOADS_NOT_ALLOWED, | 207 ASSERT_EQ(DownloadRequestLimiter::DOWNLOADS_NOT_ALLOWED, |
209 download_request_limiter_->GetDownloadStatus(contents())); | 208 download_request_limiter_->GetDownloadStatus(contents())); |
210 } | 209 } |
OLD | NEW |