| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <string> | 5 #include <string> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 : start_event_(base::WaitableEvent::ResetPolicy::MANUAL, | 523 : start_event_(base::WaitableEvent::ResetPolicy::MANUAL, |
| 524 base::WaitableEvent::InitialState::NOT_SIGNALED) {} | 524 base::WaitableEvent::InitialState::NOT_SIGNALED) {} |
| 525 | 525 |
| 526 ~FakeGoogle() {} | 526 ~FakeGoogle() {} |
| 527 | 527 |
| 528 std::unique_ptr<HttpResponse> HandleRequest(const HttpRequest& request) { | 528 std::unique_ptr<HttpResponse> HandleRequest(const HttpRequest& request) { |
| 529 // The scheme and host of the URL is actually not important but required to | 529 // The scheme and host of the URL is actually not important but required to |
| 530 // get a valid GURL in order to parse |request.relative_url|. | 530 // get a valid GURL in order to parse |request.relative_url|. |
| 531 GURL request_url = GURL("http://localhost").Resolve(request.relative_url); | 531 GURL request_url = GURL("http://localhost").Resolve(request.relative_url); |
| 532 LOG(WARNING) << "Requesting page " << request.relative_url; | 532 LOG(WARNING) << "Requesting page " << request.relative_url; |
| 533 std::string request_path = request_url.path(); | 533 base::StringPiece request_path = request_url.path(); |
| 534 std::unique_ptr<BasicHttpResponse> http_response(new BasicHttpResponse()); | 534 std::unique_ptr<BasicHttpResponse> http_response(new BasicHttpResponse()); |
| 535 if (request_path == kHelloPagePath) { // Serving "google" page. | 535 if (request_path == kHelloPagePath) { // Serving "google" page. |
| 536 start_event_.Signal(); | 536 start_event_.Signal(); |
| 537 content::BrowserThread::PostTask( | 537 content::BrowserThread::PostTask( |
| 538 content::BrowserThread::UI, FROM_HERE, | 538 content::BrowserThread::UI, FROM_HERE, |
| 539 base::Bind(&FakeGoogle::QuitRunnerOnUIThread, | 539 base::Bind(&FakeGoogle::QuitRunnerOnUIThread, |
| 540 base::Unretained(this))); | 540 base::Unretained(this))); |
| 541 | 541 |
| 542 http_response->set_code(net::HTTP_OK); | 542 http_response->set_code(net::HTTP_OK); |
| 543 http_response->set_content_type("text/html"); | 543 http_response->set_content_type("text/html"); |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 | 806 |
| 807 if (!catcher.GetNextResult()) { | 807 if (!catcher.GetNextResult()) { |
| 808 std::string message = catcher.message(); | 808 std::string message = catcher.message(); |
| 809 ADD_FAILURE() << "Tests failed: " << message; | 809 ADD_FAILURE() << "Tests failed: " << message; |
| 810 } | 810 } |
| 811 | 811 |
| 812 EXPECT_TRUE(fake_google_.IsPageRequested()); | 812 EXPECT_TRUE(fake_google_.IsPageRequested()); |
| 813 } | 813 } |
| 814 | 814 |
| 815 } // namespace chromeos | 815 } // namespace chromeos |
| OLD | NEW |