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

Unified Diff: third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp

Issue 2266443002: Optimize posting of WTF::Closure and improve scheduler test mocks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cut back to just the WTF::Closure fix plus the scheduler test mock refactor. Created 4 years, 4 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/fetch/ResourceFetcherTest.cpp
diff --git a/third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp b/third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp
index f8ed1a276f6740d4ebcd09808ce2a8e17073f446..9f748b065c1532afcb9df30f011593bba130eb7c 100644
--- a/third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp
+++ b/third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp
@@ -42,6 +42,7 @@
#include "platform/heap/Member.h"
#include "platform/network/ResourceRequest.h"
#include "platform/network/ResourceTimingInfo.h"
+#include "platform/scheduler/test/fake_web_task_runner.h"
#include "platform/testing/URLTestHelpers.h"
#include "platform/testing/weburl_loader_mock.h"
#include "platform/weborigin/KURL.h"
@@ -58,20 +59,8 @@
namespace blink {
namespace {
-
const char testImageFilename[] = "white-1x1.png";
const int testImageSize = 103; // size of web/tests/data/white-1x1.png
-
-class MockTaskRunner : public blink::WebTaskRunner {
- void postTask(const WebTraceLocation&, Task*) override { }
- void postDelayedTask(const WebTraceLocation&, Task*, double) override { }
- bool runsTasksOnCurrentThread() override { return true; }
- std::unique_ptr<WebTaskRunner> clone() override { return nullptr; }
- double virtualTimeSeconds() const override { return 0.0; }
- double monotonicallyIncreasingVirtualTimeSeconds() const override { return 0.0; }
- SingleThreadTaskRunner* taskRunner() override { return nullptr; }
-};
-
}
class ResourceFetcherTestMockFetchContext : public FetchContext {
@@ -99,13 +88,13 @@ public:
private:
ResourceFetcherTestMockFetchContext()
: m_policy(CachePolicyVerify)
- , m_runner(wrapUnique(new MockTaskRunner))
+ , m_runner(wrapUnique(new scheduler::FakeWebTaskRunner))
, m_complete(false)
, m_transferSize(-1)
{ }
CachePolicy m_policy;
- std::unique_ptr<MockTaskRunner> m_runner;
+ std::unique_ptr<scheduler::FakeWebTaskRunner> m_runner;
bool m_complete;
long long m_transferSize;
};

Powered by Google App Engine
This is Rietveld 408576698