| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/macros.h" | 6 #include "base/macros.h" |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "chrome/browser/domain_reliability/service_factory.h" | 8 #include "chrome/browser/domain_reliability/service_factory.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 IN_PROC_BROWSER_TEST_F(DomainReliabilityBrowserTest, ServiceCreated) { | 75 IN_PROC_BROWSER_TEST_F(DomainReliabilityBrowserTest, ServiceCreated) { |
| 76 EXPECT_TRUE(GetService()); | 76 EXPECT_TRUE(GetService()); |
| 77 } | 77 } |
| 78 | 78 |
| 79 IN_PROC_BROWSER_TEST_F(DomainReliabilityBrowserTest, UploadAtShutdown) { | 79 IN_PROC_BROWSER_TEST_F(DomainReliabilityBrowserTest, UploadAtShutdown) { |
| 80 DomainReliabilityService* service = GetService(); | 80 DomainReliabilityService* service = GetService(); |
| 81 | 81 |
| 82 auto config = base::MakeUnique<DomainReliabilityConfig>(); | 82 auto config = base::MakeUnique<DomainReliabilityConfig>(); |
| 83 config->origin = GURL("https://localhost/"); | 83 config->origin = GURL("https://localhost/"); |
| 84 config->include_subdomains = false; | 84 config->include_subdomains = false; |
| 85 config->collectors.push_back(new GURL( | 85 config->collectors.push_back(base::MakeUnique<GURL>( |
| 86 net::URLRequestFailedJob::GetMockHttpsUrl(net::ERR_IO_PENDING))); | 86 net::URLRequestFailedJob::GetMockHttpsUrl(net::ERR_IO_PENDING))); |
| 87 config->success_sample_rate = 1.0; | 87 config->success_sample_rate = 1.0; |
| 88 config->failure_sample_rate = 1.0; | 88 config->failure_sample_rate = 1.0; |
| 89 service->AddContextForTesting(std::move(config)); | 89 service->AddContextForTesting(std::move(config)); |
| 90 | 90 |
| 91 ui_test_utils::NavigateToURL(browser(), GURL("https://localhost/")); | 91 ui_test_utils::NavigateToURL(browser(), GURL("https://localhost/")); |
| 92 | 92 |
| 93 service->ForceUploadsForTesting(); | 93 service->ForceUploadsForTesting(); |
| 94 | 94 |
| 95 // At this point, there is an upload pending. If everything goes well, the | 95 // At this point, there is an upload pending. If everything goes well, the |
| 96 // test will finish, destroy the profile, and Domain Reliability will shut | 96 // test will finish, destroy the profile, and Domain Reliability will shut |
| 97 // down properly. If things go awry, it may crash as terminating the pending | 97 // down properly. If things go awry, it may crash as terminating the pending |
| 98 // upload calls into already-destroyed parts of the component. | 98 // upload calls into already-destroyed parts of the component. |
| 99 } | 99 } |
| 100 | 100 |
| 101 } // namespace domain_reliability | 101 } // namespace domain_reliability |
| OLD | NEW |