| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/message_loop_proxy.h" | 5 #include "base/message_loop_proxy.h" |
| 6 #include "base/threading/thread.h" | 6 #include "base/threading/thread.h" |
| 7 #include "chrome/browser/sync/glue/http_bridge.h" | 7 #include "chrome/browser/sync/glue/http_bridge.h" |
| 8 #include "chrome/test/base/test_url_request_context_getter.h" | 8 #include "chrome/test/base/test_url_request_context_getter.h" |
| 9 #include "content/test/test_browser_thread.h" | 9 #include "content/test/test_browser_thread.h" |
| 10 #include "content/test/test_url_fetcher_factory.h" | 10 #include "content/test/test_url_fetcher_factory.h" |
| 11 #include "net/test/test_server.h" | 11 #include "net/test/test_server.h" |
| 12 #include "net/url_request/url_request_test_util.h" | 12 #include "net/url_request/url_request_test_util.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 using browser_sync::HttpBridge; | 15 using browser_sync::HttpBridge; |
| 16 using content::BrowserThread; |
| 16 | 17 |
| 17 namespace { | 18 namespace { |
| 18 // TODO(timsteele): Should use PathService here. See Chromium Issue 3113. | 19 // TODO(timsteele): Should use PathService here. See Chromium Issue 3113. |
| 19 const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data"); | 20 const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data"); |
| 20 } | 21 } |
| 21 | 22 |
| 22 class HttpBridgeTest : public testing::Test { | 23 class HttpBridgeTest : public testing::Test { |
| 23 public: | 24 public: |
| 24 HttpBridgeTest() | 25 HttpBridgeTest() |
| 25 : test_server_(net::TestServer::TYPE_HTTP, FilePath(kDocRoot)), | 26 : test_server_(net::TestServer::TYPE_HTTP, FilePath(kDocRoot)), |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 http_bridge->SetPostPayload("text/plain", 2, " "); | 295 http_bridge->SetPostPayload("text/plain", 2, " "); |
| 295 | 296 |
| 296 int os_error = 0; | 297 int os_error = 0; |
| 297 int response_code = 0; | 298 int response_code = 0; |
| 298 | 299 |
| 299 bool success = http_bridge->MakeSynchronousPost(&os_error, &response_code); | 300 bool success = http_bridge->MakeSynchronousPost(&os_error, &response_code); |
| 300 ASSERT_TRUE(success); | 301 ASSERT_TRUE(success); |
| 301 http_bridge->Abort(); | 302 http_bridge->Abort(); |
| 302 // Ensures no double-free of URLFetcher, etc. | 303 // Ensures no double-free of URLFetcher, etc. |
| 303 } | 304 } |
| OLD | NEW |