Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1776)

Unified Diff: media/blink/buffered_resource_loader_unittest.cc

Issue 1534273002: Switch to standard integer types in media/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/blink/buffered_resource_loader_unittest.cc
diff --git a/media/blink/buffered_resource_loader_unittest.cc b/media/blink/buffered_resource_loader_unittest.cc
index bf9a91177da79110def8b4a503041863bfa9d95e..0974b5dce8beafa21197bbe700746cc48b141f8e 100644
--- a/media/blink/buffered_resource_loader_unittest.cc
+++ b/media/blink/buffered_resource_loader_unittest.cc
@@ -117,11 +117,11 @@ class BufferedResourceLoaderTest : public testing::Test {
view_->mainFrame());
}
- void FullResponse(int64 instance_size) {
+ void FullResponse(int64_t instance_size) {
FullResponse(instance_size, BufferedResourceLoader::kOk);
}
- void FullResponse(int64 instance_size,
+ void FullResponse(int64_t instance_size,
BufferedResourceLoader::Status status) {
EXPECT_CALL(*this, StartCallback(status));
@@ -141,13 +141,17 @@ class BufferedResourceLoaderTest : public testing::Test {
EXPECT_FALSE(loader_->range_supported());
}
- void PartialResponse(int64 first_position, int64 last_position,
- int64 instance_size) {
+ void PartialResponse(int64_t first_position,
+ int64_t last_position,
+ int64_t instance_size) {
PartialResponse(first_position, last_position, instance_size, false, true);
}
- void PartialResponse(int64 first_position, int64 last_position,
- int64 instance_size, bool chunked, bool accept_ranges) {
+ void PartialResponse(int64_t first_position,
+ int64_t last_position,
+ int64_t instance_size,
+ bool chunked,
+ bool accept_ranges) {
EXPECT_CALL(*this, StartCallback(BufferedResourceLoader::kOk));
WebURLResponse response(gurl_);
@@ -159,7 +163,7 @@ class BufferedResourceLoaderTest : public testing::Test {
instance_size)));
// HTTP 1.1 doesn't permit Content-Length with Transfer-Encoding: chunked.
- int64 content_length = -1;
+ int64_t content_length = -1;
if (chunked) {
response.setHTTPHeaderField(WebString::fromUTF8("Transfer-Encoding"),
WebString::fromUTF8("chunked"));
@@ -233,18 +237,18 @@ class BufferedResourceLoaderTest : public testing::Test {
}
// Helper method to read from |loader_|.
- void ReadLoader(int64 position, int size, uint8* buffer) {
+ void ReadLoader(int64_t position, int size, uint8_t* buffer) {
loader_->Read(position, size, buffer,
base::Bind(&BufferedResourceLoaderTest::ReadCallback,
base::Unretained(this)));
}
// Verifies that data in buffer[0...size] is equal to data_[pos...pos+size].
- void VerifyBuffer(uint8* buffer, int pos, int size) {
+ void VerifyBuffer(uint8_t* buffer, int pos, int size) {
EXPECT_EQ(0, memcmp(buffer, data_ + pos, size));
}
- void ConfirmLoaderOffsets(int64 expected_offset,
+ void ConfirmLoaderOffsets(int64_t expected_offset,
int expected_first_offset,
int expected_last_offset) {
EXPECT_EQ(loader_->offset_, expected_offset);
@@ -290,12 +294,12 @@ class BufferedResourceLoaderTest : public testing::Test {
MOCK_METHOD1(StartCallback, void(BufferedResourceLoader::Status));
MOCK_METHOD2(ReadCallback, void(BufferedResourceLoader::Status, int));
MOCK_METHOD1(LoadingCallback, void(BufferedResourceLoader::LoadingState));
- MOCK_METHOD1(ProgressCallback, void(int64));
+ MOCK_METHOD1(ProgressCallback, void(int64_t));
protected:
GURL gurl_;
- int64 first_position_;
- int64 last_position_;
+ int64_t first_position_;
+ int64_t last_position_;
scoped_ptr<BufferedResourceLoader> loader_;
NiceMock<MockWebURLLoader>* url_loader_;
@@ -306,7 +310,7 @@ class BufferedResourceLoaderTest : public testing::Test {
base::MessageLoop message_loop_;
- uint8 data_[kDataSize];
+ uint8_t data_[kDataSize];
private:
DISALLOW_COPY_AND_ASSIGN(BufferedResourceLoaderTest);
@@ -401,7 +405,7 @@ TEST_F(BufferedResourceLoaderTest, BufferAndRead) {
Start();
PartialResponse(10, 29, 30);
- uint8 buffer[10];
+ uint8_t buffer[10];
InSequence s;
// Writes 10 bytes and read them back.
@@ -453,7 +457,7 @@ TEST_F(BufferedResourceLoaderTest, ReadExtendBuffer) {
Start();
PartialResponse(10, 0x014FFFFFF, 0x015000000);
- uint8 buffer[20];
+ uint8_t buffer[20];
InSequence s;
// Write more than forward capacity and read it back. Ensure forward capacity
@@ -502,7 +506,7 @@ TEST_F(BufferedResourceLoaderTest, ReadOutsideBuffer) {
Start();
PartialResponse(10, 0x00FFFFFF, 0x01000000);
- uint8 buffer[10];
+ uint8_t buffer[10];
InSequence s;
// Read very far ahead will get a cache miss.
@@ -531,7 +535,7 @@ TEST_F(BufferedResourceLoaderTest, RequestFailedWhenRead) {
Start();
PartialResponse(10, 29, 30);
- uint8 buffer[10];
+ uint8_t buffer[10];
InSequence s;
// We should convert any error we receive to BufferedResourceLoader::kFailed.
@@ -549,7 +553,7 @@ TEST_F(BufferedResourceLoaderTest, RequestFailedWithNoPendingReads) {
Start();
PartialResponse(10, 29, 30);
- uint8 buffer[10];
+ uint8_t buffer[10];
InSequence s;
// Write enough data so that a read would technically complete had the request
@@ -573,7 +577,7 @@ TEST_F(BufferedResourceLoaderTest, RequestCancelledWhenRead) {
Start();
PartialResponse(10, 29, 30);
- uint8 buffer[10];
+ uint8_t buffer[10];
InSequence s;
// We should convert any error we receive to BufferedResourceLoader::kFailed.
@@ -594,7 +598,7 @@ TEST_F(BufferedResourceLoaderTest, NeverDeferStrategy) {
Start();
PartialResponse(10, 99, 100);
- uint8 buffer[10];
+ uint8_t buffer[10];
// Read past the buffer size; should not defer regardless.
WriteLoader(10, 10);
@@ -615,7 +619,7 @@ TEST_F(BufferedResourceLoaderTest, ReadThenDeferStrategy) {
Start();
PartialResponse(10, 99, 100);
- uint8 buffer[10];
+ uint8_t buffer[10];
// Make an outstanding read request.
ReadLoader(10, 10, buffer);
@@ -664,7 +668,7 @@ TEST_F(BufferedResourceLoaderTest, ThresholdDeferStrategy) {
Start();
PartialResponse(10, 99, 100);
- uint8 buffer[10];
+ uint8_t buffer[10];
InSequence s;
// Write half of capacity: keep not deferring.
@@ -692,7 +696,7 @@ TEST_F(BufferedResourceLoaderTest, Tricky_ReadForwardsPastBuffered) {
Start();
PartialResponse(10, 99, 100);
- uint8 buffer[256];
+ uint8_t buffer[256];
InSequence s;
// PRECONDITION
@@ -737,7 +741,7 @@ TEST_F(BufferedResourceLoaderTest, Tricky_ReadBackwardsPastBuffered) {
Start();
PartialResponse(10, 99, 100);
- uint8 buffer[256];
+ uint8_t buffer[256];
InSequence s;
// PRECONDITION
@@ -770,7 +774,7 @@ TEST_F(BufferedResourceLoaderTest, Tricky_SmallReadWithinThreshold) {
Start();
PartialResponse(10, 99, 100);
- uint8 buffer[256];
+ uint8_t buffer[256];
InSequence s;
// PRECONDITION
@@ -818,7 +822,7 @@ TEST_F(BufferedResourceLoaderTest, Tricky_LargeReadWithinThreshold) {
Start();
PartialResponse(10, 99, 100);
- uint8 buffer[256];
+ uint8_t buffer[256];
InSequence s;
// PRECONDITION
@@ -873,7 +877,7 @@ TEST_F(BufferedResourceLoaderTest, Tricky_LargeReadBackwards) {
Start();
PartialResponse(10, 99, 100);
- uint8 buffer[256];
+ uint8_t buffer[256];
InSequence s;
// PRECONDITION
@@ -934,7 +938,7 @@ TEST_F(BufferedResourceLoaderTest, Tricky_ReadPastThreshold) {
Start();
PartialResponse(10, kSize - 1, kSize);
- uint8 buffer[256];
+ uint8_t buffer[256];
InSequence s;
// PRECONDITION
@@ -1092,10 +1096,12 @@ TEST_F(BufferedResourceLoaderTest, BufferWindow_PlaybackRate_AboveUpperBound) {
StopWhenLoad();
}
-static void ExpectContentRange(
- const std::string& str, bool expect_success,
- int64 expected_first, int64 expected_last, int64 expected_size) {
- int64 first, last, size;
+static void ExpectContentRange(const std::string& str,
+ bool expect_success,
+ int64_t expected_first,
+ int64_t expected_last,
+ int64_t expected_size) {
+ int64_t first, last, size;
ASSERT_EQ(expect_success, BufferedResourceLoader::ParseContentRange(
str, &first, &last, &size)) << str;
if (!expect_success)
@@ -1109,9 +1115,10 @@ static void ExpectContentRangeFailure(const std::string& str) {
ExpectContentRange(str, false, 0, 0, 0);
}
-static void ExpectContentRangeSuccess(
- const std::string& str,
- int64 expected_first, int64 expected_last, int64 expected_size) {
+static void ExpectContentRangeSuccess(const std::string& str,
+ int64_t expected_first,
+ int64_t expected_last,
+ int64_t expected_size) {
ExpectContentRange(str, true, expected_first, expected_last, expected_size);
}
@@ -1142,7 +1149,7 @@ TEST_F(BufferedResourceLoaderTest, CancelAfterDeferral) {
Start();
PartialResponse(10, 99, 100);
- uint8 buffer[10];
+ uint8_t buffer[10];
// Make an outstanding read request.
ReadLoader(10, 10, buffer);

Powered by Google App Engine
This is Rietveld 408576698