Commit 2d103814 authored by Esmael El-Moslimany's avatar Esmael El-Moslimany Committed by Commit Bot

WebUI NTP: do not load promo for tests

Bug: 1056063
Change-Id: I513d5d1d4b0629aef7bbe85cf48dbb10e43bccc6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2076533
Commit-Queue: Esmael Elmoslimany <aee@chromium.org>
Reviewed-by: default avatarTibor Goldschwendt <tiborg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#745598}
parent eb254530
......@@ -93,8 +93,7 @@
</ntp-voice-search-overlay>
</template>
</dom-if>
<iframe id="promo" src="chrome-untrusted://new-tab-page/promo"
hidden$="[[!promoLoaded_]]"></iframe>
<iframe id="promo" src$="[[promoUrl_]]" hidden$="[[!promoLoaded_]]"></iframe>
<cr-button id="customizeButton" on-click="onCustomizeClick_">
<div id="customizeIcon"></div>
$i18n{customizeButton}
......
......@@ -27,6 +27,15 @@ class AppElement extends PolymerElement {
static get properties() {
return {
/** @private */
promoLoaded_: {
type: Boolean,
value: false,
},
/** @private */
promoUrl_: String,
/** @private {!newTabPage.mojom.Theme} */
theme_: Object,
......@@ -44,10 +53,9 @@ class AppElement extends PolymerElement {
this.callbackRouter_ = BrowserProxy.getInstance().callbackRouter;
/** @private {?number} */
this.setThemeListenerId_ = null;
/** @private {boolean} */
this.promoLoaded_ = false;
/** @private {!EventTracker} */
this.eventTracker_ = new EventTracker();
this.promoUrl_ = BrowserProxy.getInstance().promoUrl;
}
/** @override */
......
......@@ -23,6 +23,9 @@ export class BrowserProxy {
factory.createPageHandler(
this.callbackRouter.$.bindNewPipeAndPassRemote(),
this.handler.$.bindNewPipeAndPassReceiver());
/** @type {string} */
this.promoUrl = 'chrome-untrusted://new-tab-page/promo';
}
/** @param {string} href */
......
......@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// TODO(crbug.com/1057147): add tests for chrome-untrusted://new-tab-page files.
document.addEventListener('DOMContentLoaded', () => {
// Remove the <style> from the raw promo since we want to style the promo
// ourselves.
......
......@@ -45,7 +45,7 @@ void UntrustedSource::StartDataRequest(
const std::string path = content::URLDataSource::URLToRequestPath(url);
if (path == "promo") {
if (!promo_service_) {
std::string empty = "";
std::string empty;
std::move(callback).Run(base::RefCountedString::TakeString(&empty));
return;
}
......
......@@ -72,5 +72,6 @@ export function createTestProxy() {
testProxy.callbackRouterRemote =
testProxy.callbackRouter.$.bindNewPipeAndPassRemote();
testProxy.handler = mock(newTabPage.mojom.PageHandlerRemote);
testProxy.promoUrl = '';
return testProxy;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment