| Index: chrome/browser/download/download_danger_prompt_browsertest.cc
|
| diff --git a/chrome/browser/download/download_danger_prompt_browsertest.cc b/chrome/browser/download/download_danger_prompt_browsertest.cc
|
| index 9986c5d6b179ad492dcd6c9a04b10a0707d12a4f..6ec7be9d47d0be68fcf91407771b1f194e42c1f4 100644
|
| --- a/chrome/browser/download/download_danger_prompt_browsertest.cc
|
| +++ b/chrome/browser/download/download_danger_prompt_browsertest.cc
|
| @@ -8,7 +8,7 @@
|
| #include "build/build_config.h"
|
| #include "chrome/browser/download/download_danger_prompt.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| -#include "chrome/browser/safe_browsing/safe_browsing_service.h"
|
| +#include "chrome/browser/safe_browsing/test_safe_browsing_service.h"
|
| #include "chrome/browser/ui/browser.h"
|
| #include "chrome/browser/ui/browser_commands.h"
|
| #include "chrome/browser/ui/browser_tabstrip.h"
|
| @@ -34,52 +34,14 @@ using safe_browsing::SafeBrowsingService;
|
|
|
| const char kTestDownloadUrl[] = "http://evildownload.com";
|
|
|
| -class FakeSafeBrowsingService : public SafeBrowsingService {
|
| - public:
|
| - FakeSafeBrowsingService() {}
|
| -
|
| - void SendSerializedDownloadReport(const std::string& report) override {
|
| - report_ = report;
|
| - }
|
| -
|
| - std::string GetDownloadRecoveryReport() const { return report_; }
|
| -
|
| - protected:
|
| - ~FakeSafeBrowsingService() override {}
|
| -
|
| - private:
|
| - std::string report_;
|
| -};
|
| -
|
| -// Factory that creates FakeSafeBrowsingService instances.
|
| -class TestSafeBrowsingServiceFactory
|
| - : public safe_browsing::SafeBrowsingServiceFactory {
|
| - public:
|
| - TestSafeBrowsingServiceFactory() : fake_safe_browsing_service_(nullptr) {}
|
| - ~TestSafeBrowsingServiceFactory() override {}
|
| -
|
| - SafeBrowsingService* CreateSafeBrowsingService() override {
|
| - if (!fake_safe_browsing_service_) {
|
| - fake_safe_browsing_service_ = new FakeSafeBrowsingService();
|
| - }
|
| - return fake_safe_browsing_service_.get();
|
| - }
|
| -
|
| - scoped_refptr<FakeSafeBrowsingService> fake_safe_browsing_service() {
|
| - return fake_safe_browsing_service_;
|
| - }
|
| -
|
| - private:
|
| - scoped_refptr<FakeSafeBrowsingService> fake_safe_browsing_service_;
|
| -};
|
| -
|
| class DownloadDangerPromptTest : public InProcessBrowserTest {
|
| public:
|
| DownloadDangerPromptTest()
|
| : prompt_(nullptr),
|
| expected_action_(DownloadDangerPrompt::CANCEL),
|
| did_receive_callback_(false),
|
| - test_safe_browsing_factory_(new TestSafeBrowsingServiceFactory()),
|
| + test_safe_browsing_factory_(
|
| + new safe_browsing::TestSafeBrowsingServiceFactory()),
|
| report_sent_(false) {}
|
|
|
| ~DownloadDangerPromptTest() override {}
|
| @@ -127,8 +89,8 @@ class DownloadDangerPromptTest : public InProcessBrowserTest {
|
| testing::Mock::VerifyAndClearExpectations(&download_);
|
| if (report_sent_) {
|
| EXPECT_EQ(expected_serialized_report_,
|
| - test_safe_browsing_factory_->fake_safe_browsing_service()
|
| - ->GetDownloadRecoveryReport());
|
| + test_safe_browsing_factory_->test_safe_browsing_service()
|
| + ->serilized_download_report());
|
| }
|
| }
|
|
|
| @@ -181,7 +143,8 @@ class DownloadDangerPromptTest : public InProcessBrowserTest {
|
| DownloadDangerPrompt* prompt_;
|
| DownloadDangerPrompt::Action expected_action_;
|
| bool did_receive_callback_;
|
| - std::unique_ptr<TestSafeBrowsingServiceFactory> test_safe_browsing_factory_;
|
| + std::unique_ptr<safe_browsing::TestSafeBrowsingServiceFactory>
|
| + test_safe_browsing_factory_;
|
| std::string expected_serialized_report_;
|
| bool report_sent_;
|
|
|
|
|