| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/test/embedded_test_server/embedded_test_server.h" | 5 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 6 | 6 |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
| 10 #include "net/http/http_response_headers.h" | 10 #include "net/http/http_response_headers.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 protected: | 105 protected: |
| 106 int num_responses_received_; | 106 int num_responses_received_; |
| 107 int num_responses_expected_; | 107 int num_responses_expected_; |
| 108 std::string request_relative_url_; | 108 std::string request_relative_url_; |
| 109 base::Thread io_thread_; | 109 base::Thread io_thread_; |
| 110 scoped_refptr<TestURLRequestContextGetter> request_context_getter_; | 110 scoped_refptr<TestURLRequestContextGetter> request_context_getter_; |
| 111 scoped_ptr<EmbeddedTestServer> server_; | 111 scoped_ptr<EmbeddedTestServer> server_; |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 TEST_F(EmbeddedTestServerTest, GetBaseURL) { | 114 TEST_F(EmbeddedTestServerTest, GetBaseURL) { |
| 115 EXPECT_EQ(base::StringPrintf("http://127.0.0.1:%d/", server_->port()), | 115 EXPECT_EQ(base::StringPrintf("http://127.0.0.1:%u/", server_->port()), |
| 116 server_->base_url().spec()); | 116 server_->base_url().spec()); |
| 117 } | 117 } |
| 118 | 118 |
| 119 TEST_F(EmbeddedTestServerTest, GetURL) { | 119 TEST_F(EmbeddedTestServerTest, GetURL) { |
| 120 EXPECT_EQ(base::StringPrintf("http://127.0.0.1:%d/path?query=foo", | 120 EXPECT_EQ(base::StringPrintf("http://127.0.0.1:%u/path?query=foo", |
| 121 server_->port()), | 121 server_->port()), |
| 122 server_->GetURL("/path?query=foo").spec()); | 122 server_->GetURL("/path?query=foo").spec()); |
| 123 } | 123 } |
| 124 | 124 |
| 125 TEST_F(EmbeddedTestServerTest, GetURLWithHostname) { | 125 TEST_F(EmbeddedTestServerTest, GetURLWithHostname) { |
| 126 EXPECT_EQ(base::StringPrintf("http://foo.com:%d/path?query=foo", | 126 EXPECT_EQ(base::StringPrintf("http://foo.com:%d/path?query=foo", |
| 127 server_->port()), | 127 server_->port()), |
| 128 server_->GetURL("foo.com", "/path?query=foo").spec()); | 128 server_->GetURL("foo.com", "/path?query=foo").spec()); |
| 129 } | 129 } |
| 130 | 130 |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 ASSERT_TRUE(base::PlatformThread::Create(0, &delegate, &thread_handle)); | 327 ASSERT_TRUE(base::PlatformThread::Create(0, &delegate, &thread_handle)); |
| 328 base::PlatformThread::Join(thread_handle); | 328 base::PlatformThread::Join(thread_handle); |
| 329 } | 329 } |
| 330 | 330 |
| 331 INSTANTIATE_TEST_CASE_P(EmbeddedTestServerThreadingTestInstantiation, | 331 INSTANTIATE_TEST_CASE_P(EmbeddedTestServerThreadingTestInstantiation, |
| 332 EmbeddedTestServerThreadingTest, | 332 EmbeddedTestServerThreadingTest, |
| 333 testing::Combine(testing::Bool(), testing::Bool())); | 333 testing::Combine(testing::Bool(), testing::Bool())); |
| 334 | 334 |
| 335 } // namespace test_server | 335 } // namespace test_server |
| 336 } // namespace net | 336 } // namespace net |
| OLD | NEW |