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

Unified Diff: third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreatorTest.cpp

Issue 2420203002: Implement convertToBlob() in OffscreenCanvas (Closed)
Patch Set: rebase and fix global-interface-listing-service-worker-expected.txt Created 4 years, 2 months 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: third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreatorTest.cpp
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreatorTest.cpp b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreatorTest.cpp
index 81cec46726049147ccb1d763e99045f809b31b2f..f803460c92bb937e1f469274aa77c8bb5ec6460d 100644
--- a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreatorTest.cpp
+++ b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreatorTest.cpp
@@ -21,8 +21,14 @@ class MockCanvasAsyncBlobCreator : public CanvasAsyncBlobCreator {
MockCanvasAsyncBlobCreator(DOMUint8ClampedArray* data,
const IntSize& size,
MimeType mimeType,
- Document& document)
- : CanvasAsyncBlobCreator(data, mimeType, size, nullptr, 0, document) {}
+ Document* document)
+ : CanvasAsyncBlobCreator(data,
+ mimeType,
+ size,
+ nullptr,
+ 0,
+ document,
+ nullptr) {}
CanvasAsyncBlobCreator::IdleTaskStatus idleTaskStatus() {
return m_idleTaskStatus;
@@ -32,8 +38,8 @@ class MockCanvasAsyncBlobCreator : public CanvasAsyncBlobCreator {
MOCK_METHOD0(signalTaskSwitchInCompleteTimeoutEventForTesting, void());
protected:
- void createBlobAndInvokeCallback() override{};
- void createNullAndInvokeCallback() override{};
+ void createBlobAndReturnResult() override{};
+ void createNullAndReturnResult() override{};
void signalAlternativeCodePathFinishedForTesting() override;
void postDelayedTaskToMainThread(const WebTraceLocation&,
std::unique_ptr<WTF::Closure>,
@@ -62,7 +68,7 @@ class MockCanvasAsyncBlobCreatorWithoutStartPng
public:
MockCanvasAsyncBlobCreatorWithoutStartPng(DOMUint8ClampedArray* data,
const IntSize& size,
- Document& document)
+ Document* document)
: MockCanvasAsyncBlobCreator(data, size, MimeTypePng, document) {}
protected:
@@ -79,7 +85,7 @@ class MockCanvasAsyncBlobCreatorWithoutCompletePng
public:
MockCanvasAsyncBlobCreatorWithoutCompletePng(DOMUint8ClampedArray* data,
const IntSize& size,
- Document& document)
+ Document* document)
: MockCanvasAsyncBlobCreator(data, size, MimeTypePng, document) {}
protected:
@@ -106,7 +112,7 @@ class MockCanvasAsyncBlobCreatorWithoutStartJpeg
public:
MockCanvasAsyncBlobCreatorWithoutStartJpeg(DOMUint8ClampedArray* data,
const IntSize& size,
- Document& document)
+ Document* document)
: MockCanvasAsyncBlobCreator(data, size, MimeTypeJpeg, document) {}
protected:
@@ -123,7 +129,7 @@ class MockCanvasAsyncBlobCreatorWithoutCompleteJpeg
public:
MockCanvasAsyncBlobCreatorWithoutCompleteJpeg(DOMUint8ClampedArray* data,
const IntSize& size,
- Document& document)
+ Document* document)
: MockCanvasAsyncBlobCreator(data, size, MimeTypeJpeg, document) {}
protected:
@@ -180,7 +186,7 @@ void CanvasAsyncBlobCreatorTest::
ImageData* imageData = ImageData::create(testSize);
m_asyncBlobCreator = new MockCanvasAsyncBlobCreatorWithoutStartPng(
- imageData->data(), testSize, document());
+ imageData->data(), testSize, &document());
}
void CanvasAsyncBlobCreatorTest::
@@ -189,7 +195,7 @@ void CanvasAsyncBlobCreatorTest::
ImageData* imageData = ImageData::create(testSize);
m_asyncBlobCreator = new MockCanvasAsyncBlobCreatorWithoutCompletePng(
- imageData->data(), testSize, document());
+ imageData->data(), testSize, &document());
}
void CanvasAsyncBlobCreatorTest::prepareMockCanvasAsyncBlobCreatorFailPng() {
@@ -200,7 +206,7 @@ void CanvasAsyncBlobCreatorTest::prepareMockCanvasAsyncBlobCreatorFailPng() {
// this test case is expected to fail at initialization step before
// completion.
m_asyncBlobCreator = new MockCanvasAsyncBlobCreatorWithoutCompletePng(
- imageData->data(), testSize, document());
+ imageData->data(), testSize, &document());
}
void CanvasAsyncBlobCreatorTest::
@@ -209,7 +215,7 @@ void CanvasAsyncBlobCreatorTest::
ImageData* imageData = ImageData::create(testSize);
m_asyncBlobCreator = new MockCanvasAsyncBlobCreatorWithoutStartJpeg(
- imageData->data(), testSize, document());
+ imageData->data(), testSize, &document());
}
void CanvasAsyncBlobCreatorTest::
@@ -218,7 +224,7 @@ void CanvasAsyncBlobCreatorTest::
ImageData* imageData = ImageData::create(testSize);
m_asyncBlobCreator = new MockCanvasAsyncBlobCreatorWithoutCompleteJpeg(
- imageData->data(), testSize, document());
+ imageData->data(), testSize, &document());
}
void CanvasAsyncBlobCreatorTest::prepareMockCanvasAsyncBlobCreatorFailJpeg() {
@@ -229,7 +235,7 @@ void CanvasAsyncBlobCreatorTest::prepareMockCanvasAsyncBlobCreatorFailJpeg() {
// this test case is expected to fail at initialization step before
// completion.
m_asyncBlobCreator = new MockCanvasAsyncBlobCreatorWithoutCompleteJpeg(
- imageData->data(), testSize, document());
+ imageData->data(), testSize, &document());
}
void CanvasAsyncBlobCreatorTest::TearDown() {
@@ -252,7 +258,7 @@ TEST_F(CanvasAsyncBlobCreatorTest,
testing::enterRunLoop();
::testing::Mock::VerifyAndClearExpectations(asyncBlobCreator());
- EXPECT_EQ(IdleTaskStatus::IdleTaskSwitchedToMainThreadTask,
+ EXPECT_EQ(IdleTaskStatus::IdleTaskSwitchedToImmediateTask,
this->asyncBlobCreator()->idleTaskStatus());
}
@@ -270,7 +276,7 @@ TEST_F(CanvasAsyncBlobCreatorTest,
testing::enterRunLoop();
::testing::Mock::VerifyAndClearExpectations(asyncBlobCreator());
- EXPECT_EQ(IdleTaskStatus::IdleTaskSwitchedToMainThreadTask,
+ EXPECT_EQ(IdleTaskStatus::IdleTaskSwitchedToImmediateTask,
this->asyncBlobCreator()->idleTaskStatus());
}
@@ -296,11 +302,11 @@ TEST_F(CanvasAsyncBlobCreatorTest,
EXPECT_CALL(*(asyncBlobCreator()),
signalTaskSwitchInStartTimeoutEventForTesting());
- this->asyncBlobCreator()->scheduleAsyncBlobCreation(true, 1.0);
+ this->asyncBlobCreator()->scheduleAsyncBlobCreation(1.0);
testing::enterRunLoop();
::testing::Mock::VerifyAndClearExpectations(asyncBlobCreator());
- EXPECT_EQ(IdleTaskStatus::IdleTaskSwitchedToMainThreadTask,
+ EXPECT_EQ(IdleTaskStatus::IdleTaskSwitchedToImmediateTask,
this->asyncBlobCreator()->idleTaskStatus());
}
@@ -310,11 +316,11 @@ TEST_F(CanvasAsyncBlobCreatorTest,
EXPECT_CALL(*(asyncBlobCreator()),
signalTaskSwitchInCompleteTimeoutEventForTesting());
- this->asyncBlobCreator()->scheduleAsyncBlobCreation(true, 1.0);
+ this->asyncBlobCreator()->scheduleAsyncBlobCreation(1.0);
testing::enterRunLoop();
::testing::Mock::VerifyAndClearExpectations(asyncBlobCreator());
- EXPECT_EQ(IdleTaskStatus::IdleTaskSwitchedToMainThreadTask,
+ EXPECT_EQ(IdleTaskStatus::IdleTaskSwitchedToImmediateTask,
this->asyncBlobCreator()->idleTaskStatus());
}
@@ -322,7 +328,7 @@ TEST_F(CanvasAsyncBlobCreatorTest,
JpegIdleTaskFailedWhenStartTimeoutEventHappens) {
this->prepareMockCanvasAsyncBlobCreatorFailJpeg();
- this->asyncBlobCreator()->scheduleAsyncBlobCreation(true, 1.0);
+ this->asyncBlobCreator()->scheduleAsyncBlobCreation(1.0);
testing::enterRunLoop();
EXPECT_EQ(IdleTaskStatus::IdleTaskFailed,

Powered by Google App Engine
This is Rietveld 408576698