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

Side by Side Diff: third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp

Issue 2123783002: Expose RunsTasksOnCurrentThread through WebTaskRunner (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@00_fix_thread_affinity
Patch Set: rebase Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2013, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 response.setHTTPStatusCode(200); 148 response.setHTTPStatusCode(200);
149 response.setMimeType(mimeType); 149 response.setMimeType(mimeType);
150 imageResource->responseReceived(response, nullptr); 150 imageResource->responseReceived(response, nullptr);
151 imageResource->appendData(reinterpret_cast<const char*>(data.data()), data.s ize()); 151 imageResource->appendData(reinterpret_cast<const char*>(data.data()), data.s ize());
152 imageResource->finish(); 152 imageResource->finish();
153 } 153 }
154 154
155 class MockTaskRunner : public blink::WebTaskRunner { 155 class MockTaskRunner : public blink::WebTaskRunner {
156 void postTask(const WebTraceLocation&, Task*) override { } 156 void postTask(const WebTraceLocation&, Task*) override { }
157 void postDelayedTask(const WebTraceLocation&, Task*, double) override { } 157 void postDelayedTask(const WebTraceLocation&, Task*, double) override { }
158 bool runsTasksOnCurrentThread() override { return true; }
158 WebTaskRunner* clone() override { return nullptr; } 159 WebTaskRunner* clone() override { return nullptr; }
159 double virtualTimeSeconds() const override { return 0.0; } 160 double virtualTimeSeconds() const override { return 0.0; }
160 double monotonicallyIncreasingVirtualTimeSeconds() const override { return 0 .0; } 161 double monotonicallyIncreasingVirtualTimeSeconds() const override { return 0 .0; }
161 }; 162 };
162 163
163 } 164 }
164 165
165 class ImageResourceTestMockFetchContext : public FetchContext { 166 class ImageResourceTestMockFetchContext : public FetchContext {
166 public: 167 public:
167 static ImageResourceTestMockFetchContext* create() 168 static ImageResourceTestMockFetchContext* create()
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 Persistent<MockResourceClient> client2 = new MockResourceClient(imageResourc e); 613 Persistent<MockResourceClient> client2 = new MockResourceClient(imageResourc e);
613 614
614 ASSERT_TRUE(imageResource->hasImage()); 615 ASSERT_TRUE(imageResource->hasImage());
615 EXPECT_FALSE(imageResource->getImage()->isNull()); 616 EXPECT_FALSE(imageResource->getImage()->isNull());
616 EXPECT_EQ(1, imageResource->getImage()->width()); 617 EXPECT_EQ(1, imageResource->getImage()->width());
617 EXPECT_EQ(1, imageResource->getImage()->height()); 618 EXPECT_EQ(1, imageResource->getImage()->height());
618 EXPECT_TRUE(client2->notifyFinishedCalled()); 619 EXPECT_TRUE(client2->notifyFinishedCalled());
619 } 620 }
620 621
621 } // namespace blink 622 } // namespace blink
OLDNEW
« no previous file with comments | « components/scheduler/child/web_task_runner_impl.cc ('k') | third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698