| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_UNITTEST_CC_ | |
| 6 #define CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_UNITTEST_CC_ | |
| 7 | |
| 8 #include "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 9 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 6 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 10 #include "chrome/browser/safe_browsing/safe_browsing_util.h" | 7 #include "chrome/browser/safe_browsing/safe_browsing_util.h" |
| 11 #include "chrome/browser/safe_browsing/ui_manager.h" | 8 #include "chrome/browser/safe_browsing/ui_manager.h" |
| 12 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 9 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 13 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
| 14 #include "content/public/browser/render_process_host.h" | 11 #include "content/public/browser/render_process_host.h" |
| 15 #include "content/public/browser/render_view_host.h" | 12 #include "content/public/browser/render_view_host.h" |
| 16 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
| 17 #include "content/public/test/test_browser_thread_bundle.h" | 14 #include "content/public/test/test_browser_thread_bundle.h" |
| 18 #include "content/public/test/web_contents_tester.h" | 15 #include "content/public/test/web_contents_tester.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 20 #include "url/gurl.h" | 17 #include "url/gurl.h" |
| 21 | 18 |
| 22 static const char* kGoodURL = "https://www.good.com"; | 19 static const char* kGoodURL = "https://www.good.com"; |
| 23 static const char* kBadURL = "https://www.malware.com"; | 20 static const char* kBadURL = "https://www.malware.com"; |
| 24 static const char* kBadURLWithPath = "https://www.malware.com/index.html"; | 21 static const char* kBadURLWithPath = "https://www.malware.com/index.html"; |
| 25 | 22 |
| 23 namespace safe_browsing { |
| 24 |
| 26 class SafeBrowsingUIManagerTest : public ChromeRenderViewHostTestHarness { | 25 class SafeBrowsingUIManagerTest : public ChromeRenderViewHostTestHarness { |
| 27 public: | 26 public: |
| 28 SafeBrowsingUIManagerTest() : ui_manager_(new SafeBrowsingUIManager(NULL)) {} | 27 SafeBrowsingUIManagerTest() : ui_manager_(new SafeBrowsingUIManager(NULL)) {} |
| 29 | 28 |
| 30 ~SafeBrowsingUIManagerTest() override{}; | 29 ~SafeBrowsingUIManagerTest() override{}; |
| 31 | 30 |
| 32 void SetUp() override { ChromeRenderViewHostTestHarness::SetUp(); } | 31 void SetUp() override { ChromeRenderViewHostTestHarness::SetUp(); } |
| 33 | 32 |
| 34 void TearDown() override { ChromeRenderViewHostTestHarness::TearDown(); } | 33 void TearDown() override { ChromeRenderViewHostTestHarness::TearDown(); } |
| 35 | 34 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 MakeUnsafeResourceAndNavigate(kBadURL); | 95 MakeUnsafeResourceAndNavigate(kBadURL); |
| 97 AddToWhitelist(resource); | 96 AddToWhitelist(resource); |
| 98 EXPECT_TRUE(IsWhitelisted(resource)); | 97 EXPECT_TRUE(IsWhitelisted(resource)); |
| 99 | 98 |
| 100 SafeBrowsingUIManager::UnsafeResource resource_phishing = | 99 SafeBrowsingUIManager::UnsafeResource resource_phishing = |
| 101 MakeUnsafeResource(kBadURL); | 100 MakeUnsafeResource(kBadURL); |
| 102 resource_phishing.threat_type = SB_THREAT_TYPE_URL_PHISHING; | 101 resource_phishing.threat_type = SB_THREAT_TYPE_URL_PHISHING; |
| 103 EXPECT_TRUE(IsWhitelisted(resource_phishing)); | 102 EXPECT_TRUE(IsWhitelisted(resource_phishing)); |
| 104 } | 103 } |
| 105 | 104 |
| 106 #endif // CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_UNITTEST_CC_ | 105 } // namespace safe_browsing |
| OLD | NEW |