summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Vakulenko <avakulenko@google.com>2015-09-15 14:54:42 -0700
committerAlex Vakulenko <avakulenko@google.com>2015-09-15 14:54:42 -0700
commit736346392699216622881933f3260c67c6f6f9a1 (patch)
tree4cd353a9d97d82eb8c1b5471d51f92119cc1c100
parent1cca93461f2894eb345b97bb9e8ff6724a5057c8 (diff)
downloadlibchromeos-736346392699216622881933f3260c67c6f6f9a1.tar.gz
Fix libchromeos unittests
A CL (https://android-review.googlesource.com/#/c/169912) added extra call to get the status code of request for logging which broke HttpCurlTransportAsyncTest.StartAsyncTransfer due to an unexpected method call of a mock. Also, FileStreamTest.FromFileDescriptor_WriteNonBlocking took over 4 seconds on dragonboard and there is no real reason to create a 10 MB buffer to test pipes which use only 64K. Reducing the buffer size brought the test execution time to 136 ms. BUG: 23942116 Change-Id: Ib0bc5ac6ffc7bd96ef3946c31d0cda283756bd82
-rw-r--r--chromeos/http/http_transport_curl_unittest.cc2
-rw-r--r--chromeos/streams/file_stream_unittest.cc3
2 files changed, 4 insertions, 1 deletions
diff --git a/chromeos/http/http_transport_curl_unittest.cc b/chromeos/http/http_transport_curl_unittest.cc
index 9648689..43213c0 100644
--- a/chromeos/http/http_transport_curl_unittest.cc
+++ b/chromeos/http/http_transport_curl_unittest.cc
@@ -216,6 +216,8 @@ TEST_F(HttpCurlTransportAsyncTest, StartAsyncTransfer) {
};
EXPECT_CALL(*curl_api_, MultiInit()).WillOnce(Return(multi_handle_));
+ EXPECT_CALL(*curl_api_, EasyGetInfoInt(handle_, CURLINFO_RESPONSE_CODE, _))
+ .WillRepeatedly(DoAll(SetArgPointee<2>(200), Return(CURLE_OK)));
curl_socket_callback socket_callback = nullptr;
EXPECT_CALL(*curl_api_,
diff --git a/chromeos/streams/file_stream_unittest.cc b/chromeos/streams/file_stream_unittest.cc
index c760fb5..7f01067 100644
--- a/chromeos/streams/file_stream_unittest.cc
+++ b/chromeos/streams/file_stream_unittest.cc
@@ -993,7 +993,8 @@ TEST_F(FileStreamTest, FromFileDescriptor_WriteNonBlocking) {
EXPECT_FALSE(stream->CanSeek());
EXPECT_FALSE(stream->CanGetSize());
- std::vector<char> buffer(10 * 1024 * 1024);
+ // Pipe buffer is generally 64K, so 128K should be more than enough.
+ std::vector<char> buffer(128 * 1024);
base::RandBytes(buffer.data(), buffer.size());
size_t written = 0;
size_t total_size = 0;