Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(996)

Side by Side Diff: chrome/browser/net/url_request_mock_link_doctor_job.cc

Issue 174179: Mock the LinkDoctor for tests. Should greatly decrease ErrorPage test flakiness. (Closed)
Patch Set: sync with trunk Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/net/url_request_mock_link_doctor_job.h"
6
7 #include "base/path_service.h"
8 #include "chrome/browser/google_util.h"
9 #include "chrome/common/chrome_paths.h"
10 #include "googleurl/src/gurl.h"
11 #include "net/url_request/url_request_filter.h"
12
13 namespace {
14
15 FilePath GetMockFilePath() {
16 FilePath test_dir;
17 bool success = PathService::Get(chrome::DIR_TEST_DATA, &test_dir);
18 DCHECK(success);
19 return test_dir.AppendASCII("mock-link-doctor.html");
20 }
21
22 } // namespace
23
24 /* static */
25 URLRequestJob* URLRequestMockLinkDoctorJob::Factory(URLRequest* request,
26 const std::string& scheme) {
27 return new URLRequestMockLinkDoctorJob(request);
28 }
29
30 /* static */
31 void URLRequestMockLinkDoctorJob::AddUrlHandler() {
32 URLRequestFilter* filter = URLRequestFilter::GetInstance();
33 filter->AddHostnameHandler("http",
34 GURL(google_util::kLinkDoctorBaseURL).host(),
35 URLRequestMockLinkDoctorJob::Factory);
36 }
37
38 URLRequestMockLinkDoctorJob::URLRequestMockLinkDoctorJob(URLRequest* request)
39 : URLRequestMockHTTPJob(request, GetMockFilePath()) {
40 }
OLDNEW
« no previous file with comments | « chrome/browser/net/url_request_mock_link_doctor_job.h ('k') | chrome/browser/net/url_request_mock_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698