Commit dfb56073 authored by Tibor Goldschwendt's avatar Tibor Goldschwendt Committed by Commit Bot

[webui][ntp] Change Mojo enum constants from ABCD to kAbcd format

This is now the preferred enum constant format.

Change-Id: Ia6435efd9b3a2d35dac4624b1337628b9fa2c3ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2357949
Commit-Queue: Tibor Goldschwendt <tiborg@chromium.org>
Commit-Queue: Alex Gough <ajgo@chromium.org>
Auto-Submit: Tibor Goldschwendt <tiborg@chromium.org>
Reviewed-by: default avatarAlex Gough <ajgo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#798319}
parent 055e08db
...@@ -466,7 +466,7 @@ class AppElement extends PolymerElement { ...@@ -466,7 +466,7 @@ class AppElement extends PolymerElement {
onOpenVoiceSearch_() { onOpenVoiceSearch_() {
this.showVoiceSearchOverlay_ = true; this.showVoiceSearchOverlay_ = true;
this.pageHandler_.onVoiceSearchAction( this.pageHandler_.onVoiceSearchAction(
newTabPage.mojom.VoiceSearchAction.ACTIVATE_SEARCH_BOX); newTabPage.mojom.VoiceSearchAction.kActivateSearchBox);
} }
/** @private */ /** @private */
...@@ -498,7 +498,7 @@ class AppElement extends PolymerElement { ...@@ -498,7 +498,7 @@ class AppElement extends PolymerElement {
if (ctrlKeyPressed && e.code === 'Period' && e.shiftKey) { if (ctrlKeyPressed && e.code === 'Period' && e.shiftKey) {
this.showVoiceSearchOverlay_ = true; this.showVoiceSearchOverlay_ = true;
this.pageHandler_.onVoiceSearchAction( this.pageHandler_.onVoiceSearchAction(
newTabPage.mojom.VoiceSearchAction.ACTIVATE_KEYBOARD); newTabPage.mojom.VoiceSearchAction.kActivateKeyboard);
} }
} }
...@@ -604,7 +604,7 @@ class AppElement extends PolymerElement { ...@@ -604,7 +604,7 @@ class AppElement extends PolymerElement {
computeDoodleAllowed_() { computeDoodleAllowed_() {
return loadTimeData.getBoolean('themeModeDoodlesEnabled') || return loadTimeData.getBoolean('themeModeDoodlesEnabled') ||
!this.showBackgroundImage_ && this.theme_ && !this.showBackgroundImage_ && this.theme_ &&
this.theme_.type === newTabPage.mojom.ThemeType.DEFAULT && this.theme_.type === newTabPage.mojom.ThemeType.kDefault &&
!this.theme_.isDark; !this.theme_.isDark;
} }
......
...@@ -153,14 +153,14 @@ class CustomizeBackgroundsElement extends PolymerElement { ...@@ -153,14 +153,14 @@ class CustomizeBackgroundsElement extends PolymerElement {
onCollectionClick_(e) { onCollectionClick_(e) {
this.selectedCollection = this.$.collectionsRepeat.itemForElement(e.target); this.selectedCollection = this.$.collectionsRepeat.itemForElement(e.target);
this.pageHandler_.onCustomizeDialogAction( this.pageHandler_.onCustomizeDialogAction(
newTabPage.mojom.CustomizeDialogAction.BACKGROUNDS_COLLECTION_OPENED); newTabPage.mojom.CustomizeDialogAction.kBackgroundsCollectionOpened);
} }
/** @private */ /** @private */
async onUploadFromDeviceClick_() { async onUploadFromDeviceClick_() {
this.pageHandler_.onCustomizeDialogAction( this.pageHandler_.onCustomizeDialogAction(
newTabPage.mojom.CustomizeDialogAction newTabPage.mojom.CustomizeDialogAction
.BACKGROUNDS_UPLOAD_FROM_DEVICE_CLICKED); .kBackgroundsUploadFromDeviceClicked);
const {success} = await this.pageHandler_.chooseLocalCustomBackground(); const {success} = await this.pageHandler_.chooseLocalCustomBackground();
if (success) { if (success) {
// The theme update is asynchronous. Close the dialog and allow ntp-app // The theme update is asynchronous. Close the dialog and allow ntp-app
...@@ -175,7 +175,7 @@ class CustomizeBackgroundsElement extends PolymerElement { ...@@ -175,7 +175,7 @@ class CustomizeBackgroundsElement extends PolymerElement {
BackgroundSelectionType.NO_BACKGROUND) { BackgroundSelectionType.NO_BACKGROUND) {
this.pageHandler_.onCustomizeDialogAction( this.pageHandler_.onCustomizeDialogAction(
newTabPage.mojom.CustomizeDialogAction newTabPage.mojom.CustomizeDialogAction
.BACKGROUNDS_NO_BACKGROUND_SELECTED); .kBackgroundsNoBackgroundSelected);
} }
this.backgroundSelection = {type: BackgroundSelectionType.NO_BACKGROUND}; this.backgroundSelection = {type: BackgroundSelectionType.NO_BACKGROUND};
} }
...@@ -189,7 +189,7 @@ class CustomizeBackgroundsElement extends PolymerElement { ...@@ -189,7 +189,7 @@ class CustomizeBackgroundsElement extends PolymerElement {
if (this.backgroundSelection.type !== BackgroundSelectionType.IMAGE || if (this.backgroundSelection.type !== BackgroundSelectionType.IMAGE ||
this.backgroundSelection.image !== image) { this.backgroundSelection.image !== image) {
this.pageHandler_.onCustomizeDialogAction( this.pageHandler_.onCustomizeDialogAction(
newTabPage.mojom.CustomizeDialogAction.BACKGROUNDS_IMAGE_SELECTED); newTabPage.mojom.CustomizeDialogAction.kBackgroundsImageSelected);
} }
this.backgroundSelection = { this.backgroundSelection = {
type: BackgroundSelectionType.IMAGE, type: BackgroundSelectionType.IMAGE,
......
...@@ -124,7 +124,7 @@ class CustomizeDialogElement extends PolymerElement { ...@@ -124,7 +124,7 @@ class CustomizeDialogElement extends PolymerElement {
this.$.bottomPageScrollBorder, 'show-2'), this.$.bottomPageScrollBorder, 'show-2'),
]; ];
this.pageHandler_.onCustomizeDialogAction( this.pageHandler_.onCustomizeDialogAction(
newTabPage.mojom.CustomizeDialogAction.OPEN_CLICKED); newTabPage.mojom.CustomizeDialogAction.kOpenClicked);
} }
/** @private */ /** @private */
...@@ -136,7 +136,7 @@ class CustomizeDialogElement extends PolymerElement { ...@@ -136,7 +136,7 @@ class CustomizeDialogElement extends PolymerElement {
/** @private */ /** @private */
onCancelClick_() { onCancelClick_() {
this.pageHandler_.onCustomizeDialogAction( this.pageHandler_.onCustomizeDialogAction(
newTabPage.mojom.CustomizeDialogAction.CANCEL_CLICKED); newTabPage.mojom.CustomizeDialogAction.kCancelClicked);
this.$.dialog.cancel(); this.$.dialog.cancel();
} }
...@@ -168,7 +168,7 @@ class CustomizeDialogElement extends PolymerElement { ...@@ -168,7 +168,7 @@ class CustomizeDialogElement extends PolymerElement {
assert(this.backgroundSelection.dailyRefreshCollectionId)); assert(this.backgroundSelection.dailyRefreshCollectionId));
} }
this.pageHandler_.onCustomizeDialogAction( this.pageHandler_.onCustomizeDialogAction(
newTabPage.mojom.CustomizeDialogAction.DONE_CLICKED); newTabPage.mojom.CustomizeDialogAction.kDoneClicked);
this.$.dialog.close(); this.$.dialog.close();
} }
...@@ -221,7 +221,7 @@ class CustomizeDialogElement extends PolymerElement { ...@@ -221,7 +221,7 @@ class CustomizeDialogElement extends PolymerElement {
onBackClick_() { onBackClick_() {
this.selectedCollection_ = null; this.selectedCollection_ = null;
this.pageHandler_.onCustomizeDialogAction( this.pageHandler_.onCustomizeDialogAction(
newTabPage.mojom.CustomizeDialogAction.BACKGROUNDS_BACK_CLICKED); newTabPage.mojom.CustomizeDialogAction.kBackgroundsBackClicked);
} }
/** @private */ /** @private */
...@@ -236,7 +236,7 @@ class CustomizeDialogElement extends PolymerElement { ...@@ -236,7 +236,7 @@ class CustomizeDialogElement extends PolymerElement {
} }
this.pageHandler_.onCustomizeDialogAction( this.pageHandler_.onCustomizeDialogAction(
newTabPage.mojom.CustomizeDialogAction newTabPage.mojom.CustomizeDialogAction
.BACKGROUNDS_REFRESH_TOGGLE_CLICKED); .kBackgroundsRefreshToggleClicked);
} }
} }
......
...@@ -112,8 +112,7 @@ class CustomizeShortcutsElement extends PolymerElement { ...@@ -112,8 +112,7 @@ class CustomizeShortcutsElement extends PolymerElement {
onCustomLinksClick_() { onCustomLinksClick_() {
if (!this.customLinksEnabled_) { if (!this.customLinksEnabled_) {
this.pageHandler_.onCustomizeDialogAction( this.pageHandler_.onCustomizeDialogAction(
newTabPage.mojom.CustomizeDialogAction newTabPage.mojom.CustomizeDialogAction.kShortcutsCustomLinksClicked);
.SHORTCUTS_CUSTOM_LINKS_CLICKED);
} }
this.customLinksEnabled_ = true; this.customLinksEnabled_ = true;
this.hide_ = false; this.hide_ = false;
...@@ -126,7 +125,7 @@ class CustomizeShortcutsElement extends PolymerElement { ...@@ -126,7 +125,7 @@ class CustomizeShortcutsElement extends PolymerElement {
onHideChange_(e) { onHideChange_(e) {
this.pageHandler_.onCustomizeDialogAction( this.pageHandler_.onCustomizeDialogAction(
newTabPage.mojom.CustomizeDialogAction newTabPage.mojom.CustomizeDialogAction
.SHORTCUTS_VISIBILITY_TOGGLE_CLICKED); .kShortcutsVisibilityToggleClicked);
this.hide_ = e.detail; this.hide_ = e.detail;
} }
...@@ -135,8 +134,7 @@ class CustomizeShortcutsElement extends PolymerElement { ...@@ -135,8 +134,7 @@ class CustomizeShortcutsElement extends PolymerElement {
onMostVisitedClick_() { onMostVisitedClick_() {
if (this.customLinksEnabled_) { if (this.customLinksEnabled_) {
this.pageHandler_.onCustomizeDialogAction( this.pageHandler_.onCustomizeDialogAction(
newTabPage.mojom.CustomizeDialogAction newTabPage.mojom.CustomizeDialogAction.kShortcutsMostVisitedClicked);
.SHORTCUTS_MOST_VISITED_CLICKED);
} }
this.customLinksEnabled_ = false; this.customLinksEnabled_ = false;
this.hide_ = false; this.hide_ = false;
......
...@@ -74,7 +74,7 @@ class CustomizeThemesElement extends PolymerElement { ...@@ -74,7 +74,7 @@ class CustomizeThemesElement extends PolymerElement {
/** private */ /** private */
onThemeChange_() { onThemeChange_() {
if (this.theme.type !== newTabPage.mojom.ThemeType.AUTOGENERATED) { if (this.theme.type !== newTabPage.mojom.ThemeType.kAutogenerated) {
return; return;
} }
const rgbaFrameColor = const rgbaFrameColor =
...@@ -110,11 +110,11 @@ class CustomizeThemesElement extends PolymerElement { ...@@ -110,11 +110,11 @@ class CustomizeThemesElement extends PolymerElement {
return false; return false;
} }
if (id === 'autogenerated') { if (id === 'autogenerated') {
return this.theme.type === newTabPage.mojom.ThemeType.AUTOGENERATED; return this.theme.type === newTabPage.mojom.ThemeType.kAutogenerated;
} else if (id === 'default') { } else if (id === 'default') {
return this.theme.type === newTabPage.mojom.ThemeType.DEFAULT; return this.theme.type === newTabPage.mojom.ThemeType.kDefault;
} else { } else {
return this.theme.type === newTabPage.mojom.ThemeType.CHROME && return this.theme.type === newTabPage.mojom.ThemeType.kChrome &&
id === this.theme.info.chromeThemeId; id === this.theme.info.chromeThemeId;
} }
} }
...@@ -124,7 +124,7 @@ class CustomizeThemesElement extends PolymerElement { ...@@ -124,7 +124,7 @@ class CustomizeThemesElement extends PolymerElement {
* @private * @private
*/ */
isThirdPartyTheme_() { isThirdPartyTheme_() {
return this.theme.type === newTabPage.mojom.ThemeType.THIRD_PARTY; return this.theme.type === newTabPage.mojom.ThemeType.kThirdParty;
} }
/** @private */ /** @private */
......
...@@ -49,7 +49,7 @@ class DoodleShareDialogElement extends PolymerElement { ...@@ -49,7 +49,7 @@ class DoodleShareDialogElement extends PolymerElement {
`&href=${encodeURIComponent(this.url.url)}` + `&href=${encodeURIComponent(this.url.url)}` +
`&hashtag=${encodeURIComponent('#GoogleDoodle')}`; `&hashtag=${encodeURIComponent('#GoogleDoodle')}`;
BrowserProxy.getInstance().open(url); BrowserProxy.getInstance().open(url);
this.notifyShare_(newTabPage.mojom.DoodleShareChannel.FACEBOOK); this.notifyShare_(newTabPage.mojom.DoodleShareChannel.kFacebook);
} }
/** @private */ /** @private */
...@@ -57,7 +57,7 @@ class DoodleShareDialogElement extends PolymerElement { ...@@ -57,7 +57,7 @@ class DoodleShareDialogElement extends PolymerElement {
const url = 'https://twitter.com/intent/tweet' + const url = 'https://twitter.com/intent/tweet' +
`?text=${encodeURIComponent(`${this.title}\n${this.url.url}`)}`; `?text=${encodeURIComponent(`${this.title}\n${this.url.url}`)}`;
BrowserProxy.getInstance().open(url); BrowserProxy.getInstance().open(url);
this.notifyShare_(newTabPage.mojom.DoodleShareChannel.TWITTER); this.notifyShare_(newTabPage.mojom.DoodleShareChannel.kTwitter);
} }
/** @private */ /** @private */
...@@ -65,14 +65,14 @@ class DoodleShareDialogElement extends PolymerElement { ...@@ -65,14 +65,14 @@ class DoodleShareDialogElement extends PolymerElement {
const url = `mailto:?subject=${encodeURIComponent(this.title)}` + const url = `mailto:?subject=${encodeURIComponent(this.title)}` +
`&body=${encodeURIComponent(this.url.url)}`; `&body=${encodeURIComponent(this.url.url)}`;
BrowserProxy.getInstance().navigate(url); BrowserProxy.getInstance().navigate(url);
this.notifyShare_(newTabPage.mojom.DoodleShareChannel.EMAIL); this.notifyShare_(newTabPage.mojom.DoodleShareChannel.kEmail);
} }
/** @private */ /** @private */
onCopyClick_() { onCopyClick_() {
this.$.url.select(); this.$.url.select();
navigator.clipboard.writeText(this.url.url); navigator.clipboard.writeText(this.url.url);
this.notifyShare_(newTabPage.mojom.DoodleShareChannel.LINK_COPY); this.notifyShare_(newTabPage.mojom.DoodleShareChannel.kLinkCopy);
} }
/** @private */ /** @private */
......
...@@ -306,7 +306,7 @@ class LogoElement extends PolymerElement { ...@@ -306,7 +306,7 @@ class LogoElement extends PolymerElement {
if (this.isCtaImageShown_()) { if (this.isCtaImageShown_()) {
this.showAnimation_ = true; this.showAnimation_ = true;
this.pageHandler_.onDoodleImageClicked( this.pageHandler_.onDoodleImageClicked(
newTabPage.mojom.DoodleImageType.CTA, this.interactionLogUrl_); newTabPage.mojom.DoodleImageType.kCta, this.interactionLogUrl_);
// TODO(tiborg): This is technically not correct since we don't know if // TODO(tiborg): This is technically not correct since we don't know if
// the animation has loaded yet. However, since the animation is loaded // the animation has loaded yet. However, since the animation is loaded
...@@ -314,15 +314,15 @@ class LogoElement extends PolymerElement { ...@@ -314,15 +314,15 @@ class LogoElement extends PolymerElement {
// practice this should be good enough but we could improve that in the // practice this should be good enough but we could improve that in the
// future. // future.
this.logImageRendered_( this.logImageRendered_(
newTabPage.mojom.DoodleImageType.ANIMATION, newTabPage.mojom.DoodleImageType.kAnimation,
/** @type {!url.mojom.Url} */ /** @type {!url.mojom.Url} */
(this.imageDoodle_.animationImpressionLogUrl)); (this.imageDoodle_.animationImpressionLogUrl));
return; return;
} }
this.pageHandler_.onDoodleImageClicked( this.pageHandler_.onDoodleImageClicked(
this.showAnimation_ ? newTabPage.mojom.DoodleImageType.ANIMATION : this.showAnimation_ ? newTabPage.mojom.DoodleImageType.kAnimation :
newTabPage.mojom.DoodleImageType.STATIC, newTabPage.mojom.DoodleImageType.kStatic,
null); null);
const onClickUrl = new URL(this.doodle_.image.onClickUrl.url); const onClickUrl = new URL(this.doodle_.image.onClickUrl.url);
if (this.imageClickParams_) { if (this.imageClickParams_) {
...@@ -336,8 +336,8 @@ class LogoElement extends PolymerElement { ...@@ -336,8 +336,8 @@ class LogoElement extends PolymerElement {
/** @private */ /** @private */
onImageLoad_() { onImageLoad_() {
this.logImageRendered_( this.logImageRendered_(
this.isCtaImageShown_() ? newTabPage.mojom.DoodleImageType.CTA : this.isCtaImageShown_() ? newTabPage.mojom.DoodleImageType.kCta :
newTabPage.mojom.DoodleImageType.STATIC, newTabPage.mojom.DoodleImageType.kStatic,
this.imageDoodle_.imageImpressionLogUrl); this.imageDoodle_.imageImpressionLogUrl);
} }
......
...@@ -105,23 +105,23 @@ const Error = newTabPage.mojom.VoiceSearchError; ...@@ -105,23 +105,23 @@ const Error = newTabPage.mojom.VoiceSearchError;
function toError(webkitError) { function toError(webkitError) {
switch (webkitError) { switch (webkitError) {
case 'aborted': case 'aborted':
return Error.ABORTED; return Error.kAborted;
case 'audio-capture': case 'audio-capture':
return Error.AUDIO_CAPTURE; return Error.kAudioCapture;
case 'language-not-supported': case 'language-not-supported':
return Error.LANGUAGE_NOT_SUPPORTED; return Error.kLanguageNotSupported;
case 'network': case 'network':
return Error.NETWORK; return Error.kNetwork;
case 'no-speech': case 'no-speech':
return Error.NO_SPEECH; return Error.kNoSpeech;
case 'not-allowed': case 'not-allowed':
return Error.NOT_ALLOWED; return Error.kNotAllowed;
case 'service-not-allowed': case 'service-not-allowed':
return Error.SERVICE_NOT_ALLOWED; return Error.kServiceNotAllowed;
case 'bad-grammar': case 'bad-grammar':
return Error.BAD_GRAMMAR; return Error.kBadGrammar;
default: default:
return Error.OTHER; return Error.kOther;
} }
} }
...@@ -133,10 +133,10 @@ function toError(webkitError) { ...@@ -133,10 +133,10 @@ function toError(webkitError) {
*/ */
function getErrorTimeout(error) { function getErrorTimeout(error) {
switch (error) { switch (error) {
case Error.AUDIO_CAPTURE: case Error.kAudioCapture:
case Error.NO_SPEECH: case Error.kNoSpeech:
case Error.NOT_ALLOWED: case Error.kNotAllowed:
case Error.NO_MATCH: case Error.kNoMatch:
return ERROR_TIMEOUT_LONG_MS; return ERROR_TIMEOUT_LONG_MS;
default: default:
return ERROR_TIMEOUT_SHORT_MS; return ERROR_TIMEOUT_SHORT_MS;
...@@ -209,7 +209,7 @@ class VoiceSearchOverlayElement extends PolymerElement { ...@@ -209,7 +209,7 @@ class VoiceSearchOverlayElement extends PolymerElement {
this.onError_(toError(e.error)); this.onError_(toError(e.error));
}; };
this.voiceRecognition_.onnomatch = () => { this.voiceRecognition_.onnomatch = () => {
this.onError_(Error.NO_MATCH); this.onError_(Error.kNoMatch);
}; };
/** @private {number|undefined} */ /** @private {number|undefined} */
this.timerId_ = undefined; this.timerId_ = undefined;
...@@ -239,7 +239,7 @@ class VoiceSearchOverlayElement extends PolymerElement { ...@@ -239,7 +239,7 @@ class VoiceSearchOverlayElement extends PolymerElement {
onOverlayClick_() { onOverlayClick_() {
this.$.dialog.close(); this.$.dialog.close();
this.pageHandler_.onVoiceSearchAction( this.pageHandler_.onVoiceSearchAction(
newTabPage.mojom.VoiceSearchAction.CLOSE_OVERLAY); newTabPage.mojom.VoiceSearchAction.kCloseOverlay);
} }
/** /**
...@@ -274,7 +274,7 @@ class VoiceSearchOverlayElement extends PolymerElement { ...@@ -274,7 +274,7 @@ class VoiceSearchOverlayElement extends PolymerElement {
/** @private */ /** @private */
onLearnMoreClick_() { onLearnMoreClick_() {
this.pageHandler_.onVoiceSearchAction( this.pageHandler_.onVoiceSearchAction(
newTabPage.mojom.VoiceSearchAction.SUPPORT_LINK_CLICKED); newTabPage.mojom.VoiceSearchAction.kSupportLinkClicked);
} }
/** /**
...@@ -286,7 +286,7 @@ class VoiceSearchOverlayElement extends PolymerElement { ...@@ -286,7 +286,7 @@ class VoiceSearchOverlayElement extends PolymerElement {
e.stopPropagation(); e.stopPropagation();
this.start(); this.start();
this.pageHandler_.onVoiceSearchAction( this.pageHandler_.onVoiceSearchAction(
newTabPage.mojom.VoiceSearchAction.TRY_AGAIN_LINK); newTabPage.mojom.VoiceSearchAction.kTryAgainLink);
} }
/** /**
...@@ -295,14 +295,14 @@ class VoiceSearchOverlayElement extends PolymerElement { ...@@ -295,14 +295,14 @@ class VoiceSearchOverlayElement extends PolymerElement {
*/ */
onMicClick_(e) { onMicClick_(e) {
if (this.state_ !== State.ERROR_RECEIVED || if (this.state_ !== State.ERROR_RECEIVED ||
this.error_ !== Error.NO_MATCH) { this.error_ !== Error.kNoMatch) {
return; return;
} }
// Otherwise, we close the overlay. // Otherwise, we close the overlay.
e.stopPropagation(); e.stopPropagation();
this.start(); this.start();
this.pageHandler_.onVoiceSearchAction( this.pageHandler_.onVoiceSearchAction(
newTabPage.mojom.VoiceSearchAction.TRY_AGAIN_MIC_BUTTON); newTabPage.mojom.VoiceSearchAction.kTryAgainMicButton);
} }
/** @private */ /** @private */
...@@ -324,7 +324,7 @@ class VoiceSearchOverlayElement extends PolymerElement { ...@@ -324,7 +324,7 @@ class VoiceSearchOverlayElement extends PolymerElement {
return; return;
} }
this.voiceRecognition_.abort(); this.voiceRecognition_.abort();
this.onError_(Error.NO_MATCH); this.onError_(Error.kNoMatch);
} }
/** /**
...@@ -412,7 +412,7 @@ class VoiceSearchOverlayElement extends PolymerElement { ...@@ -412,7 +412,7 @@ class VoiceSearchOverlayElement extends PolymerElement {
/** @private */ /** @private */
onFinalResult_() { onFinalResult_() {
if (!this.finalResult_) { if (!this.finalResult_) {
this.onError_(Error.NO_MATCH); this.onError_(Error.kNoMatch);
return; return;
} }
this.state_ = State.RESULT_FINAL; this.state_ = State.RESULT_FINAL;
...@@ -425,7 +425,7 @@ class VoiceSearchOverlayElement extends PolymerElement { ...@@ -425,7 +425,7 @@ class VoiceSearchOverlayElement extends PolymerElement {
new URL('/search', loadTimeData.getString('googleBaseUrl')); new URL('/search', loadTimeData.getString('googleBaseUrl'));
queryUrl.search = searchParams.toString(); queryUrl.search = searchParams.toString();
this.pageHandler_.onVoiceSearchAction( this.pageHandler_.onVoiceSearchAction(
newTabPage.mojom.VoiceSearchAction.QUERY_SUBMITTED); newTabPage.mojom.VoiceSearchAction.kQuerySubmitted);
BrowserProxy.getInstance().navigate(queryUrl.href); BrowserProxy.getInstance().navigate(queryUrl.href);
} }
...@@ -433,20 +433,20 @@ class VoiceSearchOverlayElement extends PolymerElement { ...@@ -433,20 +433,20 @@ class VoiceSearchOverlayElement extends PolymerElement {
onEnd_() { onEnd_() {
switch (this.state_) { switch (this.state_) {
case State.STARTED: case State.STARTED:
this.onError_(Error.AUDIO_CAPTURE); this.onError_(Error.kAudioCapture);
return; return;
case State.AUDIO_RECEIVED: case State.AUDIO_RECEIVED:
this.onError_(Error.NO_SPEECH); this.onError_(Error.kNoSpeech);
return; return;
case State.SPEECH_RECEIVED: case State.SPEECH_RECEIVED:
case State.RESULT_RECEIVED: case State.RESULT_RECEIVED:
this.onError_(Error.NO_MATCH); this.onError_(Error.kNoMatch);
return; return;
case State.ERROR_RECEIVED: case State.ERROR_RECEIVED:
case State.RESULT_FINAL: case State.RESULT_FINAL:
return; return;
default: default:
this.onError_(Error.OTHER); this.onError_(Error.kOther);
return; return;
} }
} }
...@@ -457,7 +457,7 @@ class VoiceSearchOverlayElement extends PolymerElement { ...@@ -457,7 +457,7 @@ class VoiceSearchOverlayElement extends PolymerElement {
*/ */
onError_(error) { onError_(error) {
this.pageHandler_.onVoiceSearchError(error); this.pageHandler_.onVoiceSearchError(error);
if (error === Error.ABORTED) { if (error === Error.kAborted) {
// We are in the process of closing voice search. // We are in the process of closing voice search.
return; return;
} }
...@@ -510,21 +510,21 @@ class VoiceSearchOverlayElement extends PolymerElement { ...@@ -510,21 +510,21 @@ class VoiceSearchOverlayElement extends PolymerElement {
*/ */
getErrorText_() { getErrorText_() {
switch (this.error_) { switch (this.error_) {
case Error.NO_SPEECH: case Error.kNoSpeech:
return 'no-speech'; return 'no-speech';
case Error.AUDIO_CAPTURE: case Error.kAudioCapture:
return 'audio-capture'; return 'audio-capture';
case Error.NETWORK: case Error.kNetwork:
return 'network'; return 'network';
case Error.NOT_ALLOWED: case Error.kNotAllowed:
case Error.SERVICE_NOT_ALLOWED: case Error.kServiceNotAllowed:
return 'not-allowed'; return 'not-allowed';
case Error.LANGUAGE_NOT_SUPPORTED: case Error.kLanguageNotSupported:
return 'language-not-supported'; return 'language-not-supported';
case Error.NO_MATCH: case Error.kNoMatch:
return 'no-match'; return 'no-match';
case Error.ABORTED: case Error.kAborted:
case Error.OTHER: case Error.kOther:
default: default:
return 'other'; return 'other';
} }
...@@ -536,13 +536,13 @@ class VoiceSearchOverlayElement extends PolymerElement { ...@@ -536,13 +536,13 @@ class VoiceSearchOverlayElement extends PolymerElement {
*/ */
getErrorLink_() { getErrorLink_() {
switch (this.error_) { switch (this.error_) {
case Error.NO_SPEECH: case Error.kNoSpeech:
case Error.AUDIO_CAPTURE: case Error.kAudioCapture:
return 'learn-more'; return 'learn-more';
case Error.NOT_ALLOWED: case Error.kNotAllowed:
case Error.SERVICE_NOT_ALLOWED: case Error.kServiceNotAllowed:
return 'details'; return 'details';
case Error.NO_MATCH: case Error.kNoMatch:
return 'try-again'; return 'try-again';
default: default:
return 'none'; return 'none';
......
...@@ -82,10 +82,10 @@ struct ChromeTheme { ...@@ -82,10 +82,10 @@ struct ChromeTheme {
}; };
enum ThemeType { enum ThemeType {
DEFAULT, kDefault,
AUTOGENERATED, kAutogenerated,
CHROME, kChrome,
THIRD_PARTY, kThirdParty,
}; };
// Additional info for third-party themes. // Additional info for third-party themes.
...@@ -187,11 +187,11 @@ struct DoodleShareButton { ...@@ -187,11 +187,11 @@ struct DoodleShareButton {
// Type of image of an image doodle. Used for metrics logging only. // Type of image of an image doodle. Used for metrics logging only.
enum DoodleImageType { enum DoodleImageType {
// Animation of an animated doodle. // Animation of an animated doodle.
ANIMATION, kAnimation,
// Static preview image of an animated doodle. // Static preview image of an animated doodle.
CTA, kCta,
// Image of a static doodle. // Image of a static doodle.
STATIC, kStatic,
}; };
// A simple or animated doodle in either dark or light mode. // A simple or animated doodle in either dark or light mode.
...@@ -245,54 +245,54 @@ struct Doodle { ...@@ -245,54 +245,54 @@ struct Doodle {
// A channel through which a doodle can be shared. // A channel through which a doodle can be shared.
enum DoodleShareChannel { enum DoodleShareChannel {
FACEBOOK, kFacebook,
TWITTER, kTwitter,
EMAIL, kEmail,
LINK_COPY, kLinkCopy,
}; };
// Action the user performed while using the customize dialog. Used for metrics // Action the user performed while using the customize dialog. Used for metrics
// logging only. Actions correspond to items in NTPLoggingEventType. // logging only. Actions correspond to items in NTPLoggingEventType.
enum CustomizeDialogAction { enum CustomizeDialogAction {
CANCEL_CLICKED, kCancelClicked,
DONE_CLICKED, kDoneClicked,
OPEN_CLICKED, kOpenClicked,
BACKGROUNDS_BACK_CLICKED, kBackgroundsBackClicked,
BACKGROUNDS_NO_BACKGROUND_SELECTED, kBackgroundsNoBackgroundSelected,
BACKGROUNDS_COLLECTION_OPENED, kBackgroundsCollectionOpened,
BACKGROUNDS_REFRESH_TOGGLE_CLICKED, kBackgroundsRefreshToggleClicked,
BACKGROUNDS_IMAGE_SELECTED, kBackgroundsImageSelected,
BACKGROUNDS_UPLOAD_FROM_DEVICE_CLICKED, kBackgroundsUploadFromDeviceClicked,
SHORTCUTS_CUSTOM_LINKS_CLICKED, kShortcutsCustomLinksClicked,
SHORTCUTS_MOST_VISITED_CLICKED, kShortcutsMostVisitedClicked,
SHORTCUTS_VISIBILITY_TOGGLE_CLICKED, kShortcutsVisibilityToggleClicked,
}; };
// Action the user performed while using voice search. Used for metrics logging // Action the user performed while using voice search. Used for metrics logging
// only. Actions correspond to items in NTPLoggingEventType. // only. Actions correspond to items in NTPLoggingEventType.
enum VoiceSearchAction { enum VoiceSearchAction {
ACTIVATE_SEARCH_BOX, kActivateSearchBox,
ACTIVATE_KEYBOARD, kActivateKeyboard,
CLOSE_OVERLAY, kCloseOverlay,
QUERY_SUBMITTED, kQuerySubmitted,
SUPPORT_LINK_CLICKED, kSupportLinkClicked,
TRY_AGAIN_LINK, kTryAgainLink,
TRY_AGAIN_MIC_BUTTON, kTryAgainMicButton,
}; };
// Errors occurred while using voice search. Errors correspond to items in // Errors occurred while using voice search. Errors correspond to items in
// NTPLoggingEventType. // NTPLoggingEventType.
enum VoiceSearchError { enum VoiceSearchError {
ABORTED, kAborted,
NO_SPEECH, kNoSpeech,
AUDIO_CAPTURE, kAudioCapture,
NETWORK, kNetwork,
NOT_ALLOWED, kNotAllowed,
LANGUAGE_NOT_SUPPORTED, kLanguageNotSupported,
NO_MATCH, kNoMatch,
SERVICE_NOT_ALLOWED, kServiceNotAllowed,
BAD_GRAMMAR, kBadGrammar,
OTHER, kOther,
}; };
// Used by the WebUI page to bootstrap bidirectional communication. // Used by the WebUI page to bootstrap bidirectional communication.
......
...@@ -162,7 +162,7 @@ suite('NewTabPageAppTest', () => { ...@@ -162,7 +162,7 @@ suite('NewTabPageAppTest', () => {
// Assert. // Assert.
assertTrue(!!app.shadowRoot.querySelector('ntp-voice-search-overlay')); assertTrue(!!app.shadowRoot.querySelector('ntp-voice-search-overlay'));
assertEquals( assertEquals(
newTabPage.mojom.VoiceSearchAction.ACTIVATE_SEARCH_BOX, newTabPage.mojom.VoiceSearchAction.kActivateSearchBox,
await testProxy.handler.whenCalled('onVoiceSearchAction')); await testProxy.handler.whenCalled('onVoiceSearchAction'));
}); });
...@@ -179,7 +179,7 @@ suite('NewTabPageAppTest', () => { ...@@ -179,7 +179,7 @@ suite('NewTabPageAppTest', () => {
// Assert. // Assert.
assertTrue(!!app.shadowRoot.querySelector('ntp-voice-search-overlay')); assertTrue(!!app.shadowRoot.querySelector('ntp-voice-search-overlay'));
assertEquals( assertEquals(
newTabPage.mojom.VoiceSearchAction.ACTIVATE_KEYBOARD, newTabPage.mojom.VoiceSearchAction.kActivateKeyboard,
await testProxy.handler.whenCalled('onVoiceSearchAction')); await testProxy.handler.whenCalled('onVoiceSearchAction'));
// Test other shortcut doesn't close voice search. // Test other shortcut doesn't close voice search.
...@@ -243,7 +243,7 @@ suite('NewTabPageAppTest', () => { ...@@ -243,7 +243,7 @@ suite('NewTabPageAppTest', () => {
test(`setting non-default theme ${allows} doodle`, async function() { test(`setting non-default theme ${allows} doodle`, async function() {
// Arrange. // Arrange.
const theme = createTheme(); const theme = createTheme();
theme.type = newTabPage.mojom.ThemeType.CHROME; theme.type = newTabPage.mojom.ThemeType.kChrome;
// Act. // Act.
testProxy.callbackRouterRemote.setTheme(theme); testProxy.callbackRouterRemote.setTheme(theme);
......
...@@ -113,7 +113,7 @@ suite('NewTabPageCustomizeThemesTest', () => { ...@@ -113,7 +113,7 @@ suite('NewTabPageCustomizeThemesTest', () => {
// Act. // Act.
customizeThemes.theme = { customizeThemes.theme = {
type: newTabPage.mojom.ThemeType.AUTOGENERATED, type: newTabPage.mojom.ThemeType.kAutogenerated,
info: { info: {
autogeneratedThemeColors: { autogeneratedThemeColors: {
frame: {value: 0xffff0000}, frame: {value: 0xffff0000},
...@@ -144,7 +144,7 @@ suite('NewTabPageCustomizeThemesTest', () => { ...@@ -144,7 +144,7 @@ suite('NewTabPageCustomizeThemesTest', () => {
// Act. // Act.
customizeThemes.theme = { customizeThemes.theme = {
type: newTabPage.mojom.ThemeType.DEFAULT, type: newTabPage.mojom.ThemeType.kDefault,
info: {chromeThemeId: 0}, info: {chromeThemeId: 0},
backgroundColor: {value: 0xffff0000}, backgroundColor: {value: 0xffff0000},
shortcutBackgroundColor: {value: 0xff00ff00}, shortcutBackgroundColor: {value: 0xff00ff00},
...@@ -175,7 +175,7 @@ suite('NewTabPageCustomizeThemesTest', () => { ...@@ -175,7 +175,7 @@ suite('NewTabPageCustomizeThemesTest', () => {
// Act. // Act.
customizeThemes.theme = { customizeThemes.theme = {
type: newTabPage.mojom.ThemeType.CHROME, type: newTabPage.mojom.ThemeType.kChrome,
info: {chromeThemeId: 0}, info: {chromeThemeId: 0},
backgroundColor: {value: 0xffff0000}, backgroundColor: {value: 0xffff0000},
shortcutBackgroundColor: {value: 0xff00ff00}, shortcutBackgroundColor: {value: 0xff00ff00},
...@@ -196,7 +196,7 @@ suite('NewTabPageCustomizeThemesTest', () => { ...@@ -196,7 +196,7 @@ suite('NewTabPageCustomizeThemesTest', () => {
// Act. // Act.
customizeThemes.theme = { customizeThemes.theme = {
type: newTabPage.mojom.ThemeType.THIRD_PARTY, type: newTabPage.mojom.ThemeType.kThirdParty,
info: { info: {
thirdPartyThemeInfo: { thirdPartyThemeInfo: {
id: 'foo', id: 'foo',
...@@ -219,7 +219,7 @@ suite('NewTabPageCustomizeThemesTest', () => { ...@@ -219,7 +219,7 @@ suite('NewTabPageCustomizeThemesTest', () => {
// Arrange. // Arrange.
const customizeThemes = createCustomizeThemes(); const customizeThemes = createCustomizeThemes();
customizeThemes.theme = { customizeThemes.theme = {
type: newTabPage.mojom.ThemeType.THIRD_PARTY, type: newTabPage.mojom.ThemeType.kThirdParty,
info: { info: {
thirdPartyThemeInfo: { thirdPartyThemeInfo: {
id: 'foo', id: 'foo',
...@@ -246,7 +246,7 @@ suite('NewTabPageCustomizeThemesTest', () => { ...@@ -246,7 +246,7 @@ suite('NewTabPageCustomizeThemesTest', () => {
// Act. // Act.
customizeThemes.theme = { customizeThemes.theme = {
type: newTabPage.mojom.ThemeType.DEFAULT, type: newTabPage.mojom.ThemeType.kDefault,
info: {chromeThemeId: 0}, info: {chromeThemeId: 0},
backgroundColor: {value: 0xffff0000}, backgroundColor: {value: 0xffff0000},
shortcutBackgroundColor: {value: 0xff00ff00}, shortcutBackgroundColor: {value: 0xff00ff00},
...@@ -262,7 +262,7 @@ suite('NewTabPageCustomizeThemesTest', () => { ...@@ -262,7 +262,7 @@ suite('NewTabPageCustomizeThemesTest', () => {
// Arrange. // Arrange.
const customizeThemes = createCustomizeThemes(); const customizeThemes = createCustomizeThemes();
customizeThemes.theme = { customizeThemes.theme = {
type: newTabPage.mojom.ThemeType.THIRD_PARTY, type: newTabPage.mojom.ThemeType.kThirdParty,
info: { info: {
thirdPartyThemeInfo: { thirdPartyThemeInfo: {
id: 'foo', id: 'foo',
......
...@@ -642,7 +642,7 @@ function createSuite(themeModeDoodlesEnabled) { ...@@ -642,7 +642,7 @@ function createSuite(themeModeDoodlesEnabled) {
// Assert (load). // Assert (load).
const [type, _, logUrl] = const [type, _, logUrl] =
await testProxy.handler.whenCalled('onDoodleImageRendered'); await testProxy.handler.whenCalled('onDoodleImageRendered');
assertEquals(newTabPage.mojom.DoodleImageType.STATIC, type); assertEquals(newTabPage.mojom.DoodleImageType.kStatic, type);
assertEquals(imageDoodle.imageImpressionLogUrl.url, logUrl.url); assertEquals(imageDoodle.imageImpressionLogUrl.url, logUrl.url);
// Act (click). // Act (click).
...@@ -652,7 +652,7 @@ function createSuite(themeModeDoodlesEnabled) { ...@@ -652,7 +652,7 @@ function createSuite(themeModeDoodlesEnabled) {
const [type2] = const [type2] =
await testProxy.handler.whenCalled('onDoodleImageClicked'); await testProxy.handler.whenCalled('onDoodleImageClicked');
const onClickUrl = await testProxy.whenCalled('open'); const onClickUrl = await testProxy.whenCalled('open');
assertEquals(newTabPage.mojom.DoodleImageType.STATIC, type2); assertEquals(newTabPage.mojom.DoodleImageType.kStatic, type2);
assertEquals( assertEquals(
'https://click.com/?ct=supi&foo=bar&hello=world', onClickUrl); 'https://click.com/?ct=supi&foo=bar&hello=world', onClickUrl);
...@@ -661,12 +661,13 @@ function createSuite(themeModeDoodlesEnabled) { ...@@ -661,12 +661,13 @@ function createSuite(themeModeDoodlesEnabled) {
await flushTasks(); await flushTasks();
$$(logo, 'ntp-doodle-share-dialog') $$(logo, 'ntp-doodle-share-dialog')
.dispatchEvent(new CustomEvent( .dispatchEvent(new CustomEvent(
'share', {detail: newTabPage.mojom.DoodleShareChannel.FACEBOOK})); 'share',
{detail: newTabPage.mojom.DoodleShareChannel.kFacebook}));
// Assert (share). // Assert (share).
const [channel, doodleId, shareId] = const [channel, doodleId, shareId] =
await testProxy.handler.whenCalled('onDoodleShared'); await testProxy.handler.whenCalled('onDoodleShared');
assertEquals(newTabPage.mojom.DoodleShareChannel.FACEBOOK, channel); assertEquals(newTabPage.mojom.DoodleShareChannel.kFacebook, channel);
assertEquals('supi', doodleId); assertEquals('supi', doodleId);
assertEquals('123', shareId); assertEquals('123', shareId);
}); });
...@@ -702,7 +703,7 @@ function createSuite(themeModeDoodlesEnabled) { ...@@ -702,7 +703,7 @@ function createSuite(themeModeDoodlesEnabled) {
// Assert (CTA load). // Assert (CTA load).
const [type, _, logUrl] = const [type, _, logUrl] =
await testProxy.handler.whenCalled('onDoodleImageRendered'); await testProxy.handler.whenCalled('onDoodleImageRendered');
assertEquals(newTabPage.mojom.DoodleImageType.CTA, type); assertEquals(newTabPage.mojom.DoodleImageType.kCta, type);
assertEquals(imageDoodle.imageImpressionLogUrl.url, logUrl.url); assertEquals(imageDoodle.imageImpressionLogUrl.url, logUrl.url);
// Act (CTA click). // Act (CTA click).
...@@ -717,13 +718,13 @@ function createSuite(themeModeDoodlesEnabled) { ...@@ -717,13 +718,13 @@ function createSuite(themeModeDoodlesEnabled) {
// Assert (CTA click). // Assert (CTA click).
const [type2, interactionLogUrl] = const [type2, interactionLogUrl] =
await testProxy.handler.whenCalled('onDoodleImageClicked'); await testProxy.handler.whenCalled('onDoodleImageClicked');
assertEquals(newTabPage.mojom.DoodleImageType.CTA, type2); assertEquals(newTabPage.mojom.DoodleImageType.kCta, type2);
assertEquals('https://interaction.com', interactionLogUrl.url); assertEquals('https://interaction.com', interactionLogUrl.url);
// Assert (animation load). Also triggered by clicking #image. // Assert (animation load). Also triggered by clicking #image.
const [type3, __, logUrl2] = const [type3, __, logUrl2] =
await testProxy.handler.whenCalled('onDoodleImageRendered'); await testProxy.handler.whenCalled('onDoodleImageRendered');
assertEquals(newTabPage.mojom.DoodleImageType.ANIMATION, type3); assertEquals(newTabPage.mojom.DoodleImageType.kAnimation, type3);
assertEquals(imageDoodle.animationImpressionLogUrl.url, logUrl2.url); assertEquals(imageDoodle.animationImpressionLogUrl.url, logUrl2.url);
// Act (animation click). // Act (animation click).
...@@ -734,7 +735,7 @@ function createSuite(themeModeDoodlesEnabled) { ...@@ -734,7 +735,7 @@ function createSuite(themeModeDoodlesEnabled) {
const [type4, ___] = const [type4, ___] =
await testProxy.handler.whenCalled('onDoodleImageClicked'); await testProxy.handler.whenCalled('onDoodleImageClicked');
const onClickUrl = await testProxy.whenCalled('open'); const onClickUrl = await testProxy.whenCalled('open');
assertEquals(newTabPage.mojom.DoodleImageType.ANIMATION, type4); assertEquals(newTabPage.mojom.DoodleImageType.kAnimation, type4);
assertEquals( assertEquals(
'https://click.com/?ct=supi&foo=bar&hello=world', onClickUrl); 'https://click.com/?ct=supi&foo=bar&hello=world', onClickUrl);
...@@ -743,12 +744,12 @@ function createSuite(themeModeDoodlesEnabled) { ...@@ -743,12 +744,12 @@ function createSuite(themeModeDoodlesEnabled) {
await flushTasks(); await flushTasks();
$$(logo, 'ntp-doodle-share-dialog') $$(logo, 'ntp-doodle-share-dialog')
.dispatchEvent(new CustomEvent( .dispatchEvent(new CustomEvent(
'share', {detail: newTabPage.mojom.DoodleShareChannel.TWITTER})); 'share', {detail: newTabPage.mojom.DoodleShareChannel.kTwitter}));
// Assert (share). // Assert (share).
const [channel, doodleId, shareId] = const [channel, doodleId, shareId] =
await testProxy.handler.whenCalled('onDoodleShared'); await testProxy.handler.whenCalled('onDoodleShared');
assertEquals(newTabPage.mojom.DoodleShareChannel.TWITTER, channel); assertEquals(newTabPage.mojom.DoodleShareChannel.kTwitter, channel);
assertEquals('supi', doodleId); assertEquals('supi', doodleId);
assertEquals('123', shareId); assertEquals('123', shareId);
}); });
......
...@@ -82,7 +82,7 @@ export function createTheme() { ...@@ -82,7 +82,7 @@ export function createTheme() {
text: {value: 0xff00000d}, text: {value: 0xff00000d},
}; };
return { return {
type: newTabPage.mojom.ThemeType.DEFAULT, type: newTabPage.mojom.ThemeType.kDefault,
info: {chromeThemeId: 0}, info: {chromeThemeId: 0},
backgroundColor: {value: 0xffff0000}, backgroundColor: {value: 0xffff0000},
shortcutBackgroundColor: {value: 0xff00ff00}, shortcutBackgroundColor: {value: 0xff00ff00},
......
...@@ -162,23 +162,23 @@ suite('NewTabPageVoiceSearchOverlayTest', () => { ...@@ -162,23 +162,23 @@ suite('NewTabPageVoiceSearchOverlayTest', () => {
voiceSearchOverlay.$.micContainer.classList.contains('receiving')); voiceSearchOverlay.$.micContainer.classList.contains('receiving'));
assertStyle(voiceSearchOverlay.$.micVolume, '--mic-volume-level', '0'); assertStyle(voiceSearchOverlay.$.micVolume, '--mic-volume-level', '0');
assertEquals( assertEquals(
Action.QUERY_SUBMITTED, Action.kQuerySubmitted,
await testProxy.handler.whenCalled('onVoiceSearchAction')); await testProxy.handler.whenCalled('onVoiceSearchAction'));
}); });
[['no-speech', 'no-speech', 'learn-more', Error.NO_SPEECH], [['no-speech', 'no-speech', 'learn-more', Error.kNoSpeech],
['audio-capture', 'audio-capture', 'learn-more', Error.AUDIO_CAPTURE], ['audio-capture', 'audio-capture', 'learn-more', Error.kAudioCapture],
['network', 'network', 'none', Error.NETWORK], ['network', 'network', 'none', Error.kNetwork],
['not-allowed', 'not-allowed', 'details', Error.NOT_ALLOWED], ['not-allowed', 'not-allowed', 'details', Error.kNotAllowed],
['service-not-allowed', 'not-allowed', 'details', Error.SERVICE_NOT_ALLOWED], ['service-not-allowed', 'not-allowed', 'details', Error.kServiceNotAllowed],
[ [
'language-not-supported', 'language-not-supported', 'none', 'language-not-supported', 'language-not-supported', 'none',
Error.LANGUAGE_NOT_SUPPORTED Error.kLanguageNotSupported
], ],
['aborted', 'other', 'none', Error.ABORTED], ['aborted', 'other', 'none', Error.kAborted],
['bad-grammar', 'other', 'none', Error.BAD_GRAMMAR], ['bad-grammar', 'other', 'none', Error.kBadGrammar],
['foo', 'other', 'none', Error.OTHER], ['foo', 'other', 'none', Error.kOther],
['no-match', 'no-match', 'try-again', Error.NO_MATCH], ['no-match', 'no-match', 'try-again', Error.kNoMatch],
].forEach(([error, text, link, logError]) => { ].forEach(([error, text, link, logError]) => {
test(`on '${error}' received shows error text`, async () => { test(`on '${error}' received shows error text`, async () => {
// Act. // Act.
...@@ -308,8 +308,8 @@ suite('NewTabPageVoiceSearchOverlayTest', () => { ...@@ -308,8 +308,8 @@ suite('NewTabPageVoiceSearchOverlayTest', () => {
assertTrue(mockSpeechRecognition.abortCalled); assertTrue(mockSpeechRecognition.abortCalled);
}); });
[['#retryLink', Action.TRY_AGAIN_LINK], [['#retryLink', Action.kTryAgainLink],
['#micButton', Action.TRY_AGAIN_MIC_BUTTON], ['#micButton', Action.kTryAgainMicButton],
].forEach(([id, action]) => { ].forEach(([id, action]) => {
test(`clicking '${id}' starts voice search if in retry state`, async () => { test(`clicking '${id}' starts voice search if in retry state`, async () => {
// Arrange. // Arrange.
...@@ -375,7 +375,7 @@ suite('NewTabPageVoiceSearchOverlayTest', () => { ...@@ -375,7 +375,7 @@ suite('NewTabPageVoiceSearchOverlayTest', () => {
// Assert. // Assert.
assertFalse(voiceSearchOverlay.$.dialog.open); assertFalse(voiceSearchOverlay.$.dialog.open);
assertEquals( assertEquals(
Action.CLOSE_OVERLAY, Action.kCloseOverlay,
await testProxy.handler.whenCalled('onVoiceSearchAction')); await testProxy.handler.whenCalled('onVoiceSearchAction'));
}); });
...@@ -386,7 +386,7 @@ suite('NewTabPageVoiceSearchOverlayTest', () => { ...@@ -386,7 +386,7 @@ suite('NewTabPageVoiceSearchOverlayTest', () => {
// Assert. // Assert.
assertFalse(voiceSearchOverlay.$.dialog.open); assertFalse(voiceSearchOverlay.$.dialog.open);
assertEquals( assertEquals(
Action.CLOSE_OVERLAY, Action.kCloseOverlay,
await testProxy.handler.whenCalled('onVoiceSearchAction')); await testProxy.handler.whenCalled('onVoiceSearchAction'));
}); });
...@@ -402,7 +402,7 @@ suite('NewTabPageVoiceSearchOverlayTest', () => { ...@@ -402,7 +402,7 @@ suite('NewTabPageVoiceSearchOverlayTest', () => {
// Assert. // Assert.
assertEquals( assertEquals(
Action.SUPPORT_LINK_CLICKED, Action.kSupportLinkClicked,
await testProxy.handler.whenCalled('onVoiceSearchAction')); await testProxy.handler.whenCalled('onVoiceSearchAction'));
}); });
}); });
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