Skip to content

Commit

Permalink
Move dom streaming helpers to core/dom/stream
Browse files Browse the repository at this point in the history
  • Loading branch information
rcebulko committed May 26, 2021
1 parent 1b17786 commit 6486151
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import {devAssert} from '../core/assert';
import {devAssert} from '../../assert';

export class DetachedDomStream {
/**
Expand Down
19 changes: 19 additions & 0 deletions src/core/dom/stream/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Copyright 2021 The AMP HTML Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS-IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

export {DetachedDomStream} from './detached';
export {streamResponseToWriter} from './response';
// TODO(#32693): Migrate DomTransformStream into core to finish the trio
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import {Deferred} from '../core/data-structures/promise';
import {Deferred} from '../../data-structures/promise';

/**
* Decodes readable stream from response and writes to given writeable stream.
Expand All @@ -23,7 +23,7 @@ import {Deferred} from '../core/data-structures/promise';
* This function should be replaced with transform stream when well supported.
* @param {!Window} win
* @param {!Response} response
* @param {!./detached-dom-stream.DetachedDomStream} writer
* @param {!./detached.DetachedDomStream} writer
* @return {!Promise<boolean>} true if response has content, false if
* the response is empty.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

import {DetachedDomStream} from '../../../src/utils/detached-dom-stream';
import {DetachedDomStream} from '../../../../../src/utils/detached-dom-stream';

describes.fakeWin('DetachedDomStream', {amp: true}, (env) => {
describes.fakeWin('DOM - stream - DetachedDomStream', {amp: true}, (env) => {
let win;
let chunkSpy;
let endSpy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

import {macroTask} from '../../../testing/yield';
import {streamResponseToWriter} from '../../../src/utils/stream-response';
import {macroTask} from '../../../../../testing/yield';
import {streamResponseToWriter} from '../../../../..src/utils/stream-response';

const chunk1 = `
<!doctype html>
Expand All @@ -33,7 +33,7 @@ const chunk2 = `
</html>
`;

describes.fakeWin('streamResponseToWriter', {}, (env) => {
describes.fakeWin('DOM - stream - streamResponseToWriter', {}, (env) => {
let writeSpy;
let closeSpy;
let mockWriter;
Expand Down

0 comments on commit 6486151

Please sign in to comment.