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_
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
{
19 TestRequestViewHandle(DistilledPagePrefs
* prefs
);
20 ~TestRequestViewHandle() override
;
22 std::string
GetJavaScriptBuffer();
23 void ClearJavaScriptBuffer();
26 void SendJavaScript(const std::string
& buffer
) override
;
30 TestRequestViewHandle::TestRequestViewHandle(DistilledPagePrefs
* prefs
)
31 : DomDistillerRequestViewBase(prefs
) {
34 TestRequestViewHandle::~TestRequestViewHandle() {
35 distilled_page_prefs_
->RemoveObserver(this);
38 std::string
TestRequestViewHandle::GetJavaScriptBuffer() {
42 void TestRequestViewHandle::ClearJavaScriptBuffer() {
46 void TestRequestViewHandle::SendJavaScript(const std::string
& buffer
) {
50 } // namespace dom_distiller
52 #endif // COMPONENTS_DOM_DISTILLER_CORE_TEST_REQUEST_VIEW_HANDLE_H_