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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 } | 377 } |
378 Command(Name name, const char* body) : Command(name, body, strlen(body)) {} | 378 Command(Name name, const char* body) : Command(name, body, strlen(body)) {} |
379 Name getName() const { return m_name; } | 379 Name getName() const { return m_name; } |
380 const Vector<char>& body() const { return m_body; } | 380 const Vector<char>& body() const { return m_body; } |
381 | 381 |
382 private: | 382 private: |
383 const Name m_name; | 383 const Name m_name; |
384 Vector<char> m_body; | 384 Vector<char> m_body; |
385 }; | 385 }; |
386 | 386 |
387 // ReplayingHandle stores commands via |add| and replays the stored commends w
hen read. | 387 // ReplayingHandle stores commands via |add| and replays the stored commends |
| 388 // when read. |
388 class ReplayingHandle final : public WebDataConsumerHandle { | 389 class ReplayingHandle final : public WebDataConsumerHandle { |
389 USING_FAST_MALLOC(ReplayingHandle); | 390 USING_FAST_MALLOC(ReplayingHandle); |
390 | 391 |
391 public: | 392 public: |
392 static std::unique_ptr<ReplayingHandle> create() { | 393 static std::unique_ptr<ReplayingHandle> create() { |
393 return wrapUnique(new ReplayingHandle()); | 394 return wrapUnique(new ReplayingHandle()); |
394 } | 395 } |
395 ~ReplayingHandle(); | 396 ~ReplayingHandle(); |
396 | 397 |
397 // Add a command to this handle. This function must be called on the | 398 // Add a command to this handle. This function must be called on the |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 std::unique_ptr<HandleReadResult> m_result; | 546 std::unique_ptr<HandleReadResult> m_result; |
546 bool m_isDone; | 547 bool m_isDone; |
547 | 548 |
548 std::unique_ptr<T> m_handleReader; | 549 std::unique_ptr<T> m_handleReader; |
549 }; | 550 }; |
550 }; | 551 }; |
551 | 552 |
552 } // namespace blink | 553 } // namespace blink |
553 | 554 |
554 #endif // DataConsumerHandleTestUtil_h | 555 #endif // DataConsumerHandleTestUtil_h |
OLD | NEW |