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/tab_contents_wrapper.h" | 7 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
8 #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" | 8 #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" |
9 #include "chrome/test/base/testing_profile.h" | 9 #include "chrome/test/base/testing_profile.h" |
10 #include "content/public/browser/navigation_controller.h" | 10 #include "content/public/browser/navigation_controller.h" |
11 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
12 #include "content/test/test_browser_thread.h" | 12 #include "content/public/test/test_browser_thread.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 using content::BrowserThread; | 15 using content::BrowserThread; |
16 using content::WebContents; | 16 using content::WebContents; |
17 | 17 |
18 class DownloadRequestLimiterTest : public TabContentsWrapperTestHarness { | 18 class DownloadRequestLimiterTest : public TabContentsWrapperTestHarness { |
19 public: | 19 public: |
20 DownloadRequestLimiterTest() | 20 DownloadRequestLimiterTest() |
21 : ui_thread_(BrowserThread::UI, &message_loop_), | 21 : ui_thread_(BrowserThread::UI, &message_loop_), |
22 file_user_blocking_thread_( | 22 file_user_blocking_thread_( |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 download_request_limiter_->GetDownloadStatus(web_contents.get())); | 270 download_request_limiter_->GetDownloadStatus(web_contents.get())); |
271 OnUserGestureFor(web_contents.get()); | 271 OnUserGestureFor(web_contents.get()); |
272 EXPECT_EQ(DownloadRequestLimiter::ALLOW_ONE_DOWNLOAD, | 272 EXPECT_EQ(DownloadRequestLimiter::ALLOW_ONE_DOWNLOAD, |
273 download_request_limiter_->GetDownloadStatus(web_contents.get())); | 273 download_request_limiter_->GetDownloadStatus(web_contents.get())); |
274 CanDownloadFor(web_contents.get()); | 274 CanDownloadFor(web_contents.get()); |
275 EXPECT_EQ(3, continue_count_); | 275 EXPECT_EQ(3, continue_count_); |
276 EXPECT_EQ(1, cancel_count_); | 276 EXPECT_EQ(1, cancel_count_); |
277 EXPECT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, | 277 EXPECT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, |
278 download_request_limiter_->GetDownloadStatus(web_contents.get())); | 278 download_request_limiter_->GetDownloadStatus(web_contents.get())); |
279 } | 279 } |
OLD | NEW |