Revert "Reland c91b178b07b0d - Delete dead signin code (SigninGlobalError)"
[chromium-blink-merge.git] / components / dom_distiller / core / test_request_view_handle.h
blob5271e59cb919dd402d679c84fc99b35fe588417b
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_DOM_DISTILLER_CORE_TEST_REQUEST_VIEW_HANDLE_H_
6 #define COMPONENTS_DOM_DISTILLER_CORE_TEST_REQUEST_VIEW_HANDLE_H_
8 #include <string>
10 #include "components/dom_distiller/core/distilled_page_prefs.h"
11 #include "components/dom_distiller/core/dom_distiller_request_view_base.h"
13 namespace dom_distiller {
15 // TestRequestViewHandle allows the javascript buffer to be collected at any
16 // point and viewed. This class is for testing only.
17 class TestRequestViewHandle : public DomDistillerRequestViewBase {
18 public:
19 TestRequestViewHandle(DistilledPagePrefs* prefs);
20 ~TestRequestViewHandle() override;
22 std::string GetJavaScriptBuffer();
23 void ClearJavaScriptBuffer();
25 private:
26 void SendJavaScript(const std::string& buffer) override;
27 std::string buffer_;
30 TestRequestViewHandle::TestRequestViewHandle(DistilledPagePrefs* prefs)
31 : DomDistillerRequestViewBase(prefs) {
34 TestRequestViewHandle::~TestRequestViewHandle() {
35 distilled_page_prefs_->RemoveObserver(this);
38 std::string TestRequestViewHandle::GetJavaScriptBuffer() {
39 return buffer_;
42 void TestRequestViewHandle::ClearJavaScriptBuffer() {
43 buffer_ = "";
46 void TestRequestViewHandle::SendJavaScript(const std::string& buffer) {
47 buffer_ += buffer;
50 } // namespace dom_distiller
52 #endif // COMPONENTS_DOM_DISTILLER_CORE_TEST_REQUEST_VIEW_HANDLE_H_