OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef DataConsumerHandleTestUtil_h | 5 #ifndef DataConsumerHandleTestUtil_h |
6 #define DataConsumerHandleTestUtil_h | 6 #define DataConsumerHandleTestUtil_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptState.h" | 8 #include "bindings/core/v8/ScriptState.h" |
9 #include "core/testing/NullExecutionContext.h" | 9 #include "core/testing/NullExecutionContext.h" |
10 #include "gin/public/isolate_holder.h" | 10 #include "gin/public/isolate_holder.h" |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 } | 342 } |
343 Command(Name name, const char* body) : Command(name, body, strlen(body)) {} | 343 Command(Name name, const char* body) : Command(name, body, strlen(body)) {} |
344 Name getName() const { return m_name; } | 344 Name getName() const { return m_name; } |
345 const Vector<char>& body() const { return m_body; } | 345 const Vector<char>& body() const { return m_body; } |
346 | 346 |
347 private: | 347 private: |
348 const Name m_name; | 348 const Name m_name; |
349 Vector<char> m_body; | 349 Vector<char> m_body; |
350 }; | 350 }; |
351 | 351 |
352 // ReplayingHandle stores commands via |add| and replays the stored commends w
hen read. | 352 // ReplayingHandle stores commands via |add| and replays the stored commends |
| 353 // when read. |
353 class ReplayingHandle final : public WebDataConsumerHandle { | 354 class ReplayingHandle final : public WebDataConsumerHandle { |
354 USING_FAST_MALLOC(ReplayingHandle); | 355 USING_FAST_MALLOC(ReplayingHandle); |
355 | 356 |
356 public: | 357 public: |
357 static std::unique_ptr<ReplayingHandle> create() { | 358 static std::unique_ptr<ReplayingHandle> create() { |
358 return wrapUnique(new ReplayingHandle()); | 359 return wrapUnique(new ReplayingHandle()); |
359 } | 360 } |
360 ~ReplayingHandle(); | 361 ~ReplayingHandle(); |
361 | 362 |
362 // Add a command to this handle. This function must be called on the | 363 // Add a command to this handle. This function must be called on the |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 std::unique_ptr<T> m_handleReader; | 514 std::unique_ptr<T> m_handleReader; |
514 }; | 515 }; |
515 | 516 |
516 static std::unique_ptr<WebDataConsumerHandle> | 517 static std::unique_ptr<WebDataConsumerHandle> |
517 createWaitingDataConsumerHandle(); | 518 createWaitingDataConsumerHandle(); |
518 }; | 519 }; |
519 | 520 |
520 } // namespace blink | 521 } // namespace blink |
521 | 522 |
522 #endif // DataConsumerHandleTestUtil_h | 523 #endif // DataConsumerHandleTestUtil_h |
OLD | NEW |