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 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 http_response->set_content_type("text/html"); | 522 http_response->set_content_type("text/html"); |
523 http_response->set_content(kGooglePageContent); | 523 http_response->set_content(kGooglePageContent); |
524 } else if (request_path == kRandomPagePath) { // Serving "non-google" page. | 524 } else if (request_path == kRandomPagePath) { // Serving "non-google" page. |
525 http_response->set_code(net::HTTP_OK); | 525 http_response->set_code(net::HTTP_OK); |
526 http_response->set_content_type("text/html"); | 526 http_response->set_content_type("text/html"); |
527 http_response->set_content(kRandomPageContent); | 527 http_response->set_content(kRandomPageContent); |
528 } else { | 528 } else { |
529 return scoped_ptr<HttpResponse>(); // Request not understood. | 529 return scoped_ptr<HttpResponse>(); // Request not understood. |
530 } | 530 } |
531 | 531 |
532 return http_response.PassAs<HttpResponse>(); | 532 return http_response.Pass(); |
533 } | 533 } |
534 | 534 |
535 // True if we have already served the test page. | 535 // True if we have already served the test page. |
536 bool IsPageRequested () { | 536 bool IsPageRequested () { |
537 return start_event_.IsSignaled(); | 537 return start_event_.IsSignaled(); |
538 } | 538 } |
539 | 539 |
540 // Waits until we receive a request to serve the test page. | 540 // Waits until we receive a request to serve the test page. |
541 void WaitForPageRequest() { | 541 void WaitForPageRequest() { |
542 // If we have already served the request, bail out. | 542 // If we have already served the request, bail out. |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 | 790 |
791 if (!catcher.GetNextResult()) { | 791 if (!catcher.GetNextResult()) { |
792 std::string message = catcher.message(); | 792 std::string message = catcher.message(); |
793 ADD_FAILURE() << "Tests failed: " << message; | 793 ADD_FAILURE() << "Tests failed: " << message; |
794 } | 794 } |
795 | 795 |
796 EXPECT_TRUE(fake_google_.IsPageRequested()); | 796 EXPECT_TRUE(fake_google_.IsPageRequested()); |
797 } | 797 } |
798 | 798 |
799 } // namespace chromeos | 799 } // namespace chromeos |
OLD | NEW |