Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
stream_capture.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "flutter/testing/stream_capture.h"
6
7namespace flutter {
8namespace testing {
9
10StreamCapture::StreamCapture(std::ostream* ostream)
11 : ostream_(ostream), old_buffer_(ostream_->rdbuf()) {
12 ostream_->rdbuf(buffer_.rdbuf());
13}
14
18
20 if (old_buffer_) {
21 ostream_->rdbuf(old_buffer_);
22 old_buffer_ = nullptr;
23 }
24}
25
26std::string StreamCapture::GetOutput() const {
27 return buffer_.str();
28}
29
30} // namespace testing
31} // namespace flutter
StreamCapture(std::ostream *ostream)