Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Side by Side Diff: components/dom_distiller/core/test_request_view_handle.h

Issue 1130703003: Show template before distiller finishes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ios-superclass
Patch Set: Fix flaky test Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #ifndef COMPONENTS_DOM_DISTILLER_CORE_TEST_REQUEST_VIEW_HANDLE_H_
6 #define COMPONENTS_DOM_DISTILLER_CORE_TEST_REQUEST_VIEW_HANDLE_H_
7
8 #include <string>
9
10 #include "components/dom_distiller/core/distilled_page_prefs.h"
11 #include "components/dom_distiller/core/dom_distiller_request_view_base.h"
12
13 namespace dom_distiller {
14
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;
21
22 std::string GetJavaScriptBuffer();
23 void ClearJavaScriptBuffer();
24
25 private:
26 void SendJavaScript(const std::string& buffer) override;
27 std::string buffer_;
28 };
29
30 TestRequestViewHandle::TestRequestViewHandle(DistilledPagePrefs* prefs)
31 : DomDistillerRequestViewBase(prefs) {
32 }
33
34 TestRequestViewHandle::~TestRequestViewHandle() {
35 distilled_page_prefs_->RemoveObserver(this);
36 }
37
38 std::string TestRequestViewHandle::GetJavaScriptBuffer() {
39 return buffer_;
40 }
41
42 void TestRequestViewHandle::ClearJavaScriptBuffer() {
43 buffer_ = "";
44 }
45
46 void TestRequestViewHandle::SendJavaScript(const std::string& buffer) {
47 buffer_ += buffer;
48 }
49
50 } // namespace dom_distiller
51
52 #endif // COMPONENTS_DOM_DISTILLER_CORE_TEST_REQUEST_VIEW_HANDLE_H_
OLDNEW
« no previous file with comments | « components/dom_distiller/core/javascript/dom_distiller_viewer.js ('k') | components/dom_distiller/core/viewer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698