aboutsummaryrefslogtreecommitdiffstats
path: root/brillo/http
diff options
context:
space:
mode:
authorHidehiko Abe <hidehiko@google.com>2017-12-18 10:37:25 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-12-18 10:37:25 +0000
commit1552abdcdfa272e771a819e77bf250ce67c5007d (patch)
tree0509206f97501283e49b3a19abee98008a3cd72f /brillo/http
parent76f2ea30c6a76fefff34cb18ee872ffa427ec145 (diff)
parentc75c1f294f97ffc108e62ed4460a3b9aad754719 (diff)
downloadplatform_external_libbrillo-1552abdcdfa272e771a819e77bf250ce67c5007d.tar.gz
platform_external_libbrillo-1552abdcdfa272e771a819e77bf250ce67c5007d.tar.bz2
platform_external_libbrillo-1552abdcdfa272e771a819e77bf250ce67c5007d.zip
libbrillo: Update libchrome APIS to r456626. am: 826000b528
am: c75c1f294f Change-Id: Ida34017e671599f602546de9f5905617b776bce5
Diffstat (limited to 'brillo/http')
-rw-r--r--brillo/http/http_form_data_unittest.cc10
-rw-r--r--brillo/http/http_transport_curl.cc11
-rw-r--r--brillo/http/http_transport_curl_unittest.cc5
3 files changed, 15 insertions, 11 deletions
diff --git a/brillo/http/http_form_data_unittest.cc b/brillo/http/http_form_data_unittest.cc
index 842225d..34288d0 100644
--- a/brillo/http/http_form_data_unittest.cc
+++ b/brillo/http/http_form_data_unittest.cc
@@ -42,7 +42,7 @@ TEST(HttpFormData, FileFormField) {
base::ScopedTempDir dir;
ASSERT_TRUE(dir.CreateUniqueTempDir());
std::string file_content{"text line1\ntext line2\n"};
- base::FilePath file_name = dir.path().Append("sample.txt");
+ base::FilePath file_name = dir.GetPath().Append("sample.txt");
ASSERT_EQ(file_content.size(),
static_cast<size_t>(base::WriteFile(
file_name, file_content.data(), file_content.size())));
@@ -70,12 +70,12 @@ TEST(HttpFormData, MultiPartFormField) {
base::ScopedTempDir dir;
ASSERT_TRUE(dir.CreateUniqueTempDir());
std::string file1{"text line1\ntext line2\n"};
- base::FilePath filename1 = dir.path().Append("sample.txt");
+ base::FilePath filename1 = dir.GetPath().Append("sample.txt");
ASSERT_EQ(file1.size(),
static_cast<size_t>(
base::WriteFile(filename1, file1.data(), file1.size())));
std::string file2{"\x01\x02\x03\x04\x05"};
- base::FilePath filename2 = dir.path().Append("test.bin");
+ base::FilePath filename2 = dir.GetPath().Append("test.bin");
ASSERT_EQ(file2.size(),
static_cast<size_t>(
base::WriteFile(filename2, file2.data(), file2.size())));
@@ -145,12 +145,12 @@ TEST(HttpFormData, FormData) {
base::ScopedTempDir dir;
ASSERT_TRUE(dir.CreateUniqueTempDir());
std::string file1{"text line1\ntext line2\n"};
- base::FilePath filename1 = dir.path().Append("sample.txt");
+ base::FilePath filename1 = dir.GetPath().Append("sample.txt");
ASSERT_EQ(file1.size(),
static_cast<size_t>(
base::WriteFile(filename1, file1.data(), file1.size())));
std::string file2{"\x01\x02\x03\x04\x05"};
- base::FilePath filename2 = dir.path().Append("test.bin");
+ base::FilePath filename2 = dir.GetPath().Append("test.bin");
ASSERT_EQ(file2.size(),
static_cast<size_t>(
base::WriteFile(filename2, file2.data(), file2.size())));
diff --git a/brillo/http/http_transport_curl.cc b/brillo/http/http_transport_curl.cc
index f7e3b71..109d2c1 100644
--- a/brillo/http/http_transport_curl.cc
+++ b/brillo/http/http_transport_curl.cc
@@ -40,7 +40,8 @@ class Transport::SocketPollData : public base::MessageLoopForIO::Watcher {
: curl_interface_(curl_interface),
curl_multi_handle_(curl_multi_handle),
transport_(transport),
- socket_fd_(socket_fd) {}
+ socket_fd_(socket_fd),
+ file_descriptor_watcher_(FROM_HERE) {}
// Returns the pointer for the socket-specific file descriptor watcher.
base::MessageLoopForIO::FileDescriptorWatcher* GetWatcher() {
@@ -203,7 +204,8 @@ std::shared_ptr<http::Connection> Transport::CreateConnection(
void Transport::RunCallbackAsync(const tracked_objects::Location& from_here,
const base::Closure& callback) {
- base::MessageLoopForIO::current()->PostTask(from_here, callback);
+ base::MessageLoopForIO::current()->task_runner()->PostTask(
+ from_here, callback);
}
RequestID Transport::StartAsyncTransfer(http::Connection* connection,
@@ -352,7 +354,8 @@ int Transport::MultiSocketCallback(CURL* easy,
poll_data->GetWatcher()->StopWatchingFileDescriptor();
// This method can be called indirectly from SocketPollData::OnSocketReady,
// so delay destruction of SocketPollData object till the next loop cycle.
- base::MessageLoopForIO::current()->DeleteSoon(FROM_HERE, poll_data);
+ base::MessageLoopForIO::current()->task_runner()->
+ DeleteSoon(FROM_HERE, poll_data);
return 0;
}
@@ -395,7 +398,7 @@ int Transport::MultiTimerCallback(CURLM* /* multi */,
// Cancel any previous timer callbacks.
transport->weak_ptr_factory_for_timer_.InvalidateWeakPtrs();
if (timeout_ms >= 0) {
- base::MessageLoopForIO::current()->PostDelayedTask(
+ base::MessageLoopForIO::current()->task_runner()->PostDelayedTask(
FROM_HERE,
base::Bind(&Transport::OnTimer,
transport->weak_ptr_factory_for_timer_.GetWeakPtr()),
diff --git a/brillo/http/http_transport_curl_unittest.cc b/brillo/http/http_transport_curl_unittest.cc
index 702c9d9..1937e73 100644
--- a/brillo/http/http_transport_curl_unittest.cc
+++ b/brillo/http/http_transport_curl_unittest.cc
@@ -209,7 +209,8 @@ TEST_F(HttpCurlTransportAsyncTest, StartAsyncTransfer) {
base::RunLoop* run_loop,
RequestID /* request_id */,
std::unique_ptr<http::Response> /* resp */) {
- base::MessageLoop::current()->PostTask(FROM_HERE, run_loop->QuitClosure());
+ base::MessageLoop::current()->task_runner()->PostTask(
+ FROM_HERE, run_loop->QuitClosure());
(*success_call_count)++;
};
@@ -277,7 +278,7 @@ TEST_F(HttpCurlTransportAsyncTest, StartAsyncTransfer) {
// Just in case something goes wrong and |success_callback| isn't called,
// post a time-out quit closure to abort the message loop after 1 second.
- message_loop.PostDelayedTask(
+ message_loop.task_runner()->PostDelayedTask(
FROM_HERE, run_loop.QuitClosure(), base::TimeDelta::FromSeconds(1));
run_loop.Run();
EXPECT_EQ(1, success_call_count);