| 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 "chrome/browser/download/download_request_limiter.h" | 5 #include "chrome/browser/download/download_request_limiter.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "chrome/browser/download/download_permission_request.h" | 10 #include "chrome/browser/download/download_permission_request.h" |
| 11 #include "chrome/browser/download/download_request_infobar_delegate.h" | 11 #include "chrome/browser/download/download_request_infobar_delegate.h" |
| 12 #include "chrome/browser/infobars/infobar_service.h" | 12 #include "chrome/browser/infobars/infobar_service.h" |
| 13 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" | 13 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" |
| 14 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
| 15 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 15 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 16 #include "chrome/test/base/testing_profile.h" | 16 #include "chrome/test/base/testing_profile.h" |
| 17 #include "components/content_settings/core/browser/host_content_settings_map.h" | 17 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 18 #include "content/public/browser/navigation_controller.h" | 18 #include "content/public/browser/navigation_controller.h" |
| 19 #include "content/public/browser/navigation_details.h" | 19 #include "content/public/browser/navigation_details.h" |
| 20 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
| 21 #include "content/public/common/frame_navigate_params.h" | 21 #include "content/public/common/frame_navigate_params.h" |
| 22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 23 | 23 |
| 24 // TODO(hcarmona): compile this |
| 25 |
| 24 using content::WebContents; | 26 using content::WebContents; |
| 25 | 27 |
| 26 class DownloadRequestLimiterTest; | 28 class DownloadRequestLimiterTest; |
| 27 | 29 |
| 28 class FakePermissionBubbleView : public PermissionBubbleView { | 30 class FakePermissionBubbleView : public PermissionBubbleView { |
| 29 public: | 31 public: |
| 30 class Factory : public base::RefCounted<FakePermissionBubbleView::Factory> { | 32 class Factory : public base::RefCounted<FakePermissionBubbleView::Factory> { |
| 31 public: | 33 public: |
| 32 explicit Factory(DownloadRequestLimiterTest* test) : test_(test) {} | 34 explicit Factory(DownloadRequestLimiterTest* test) : test_(test) {} |
| 33 | 35 |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 CanDownload(); | 478 CanDownload(); |
| 477 ExpectAndResetCounts(0, 1, 0, __LINE__); | 479 ExpectAndResetCounts(0, 1, 0, __LINE__); |
| 478 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, | 480 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, |
| 479 download_request_limiter_->GetDownloadStatus(web_contents())); | 481 download_request_limiter_->GetDownloadStatus(web_contents())); |
| 480 | 482 |
| 481 CanDownload(); | 483 CanDownload(); |
| 482 ExpectAndResetCounts(0, 1, 0, __LINE__); | 484 ExpectAndResetCounts(0, 1, 0, __LINE__); |
| 483 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, | 485 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, |
| 484 download_request_limiter_->GetDownloadStatus(web_contents())); | 486 download_request_limiter_->GetDownloadStatus(web_contents())); |
| 485 } | 487 } |
| OLD | NEW |