Commit 637282e5 authored by Xi Han's avatar Xi Han Committed by Commit Bot

[Instant Start] Show voice search button in search box.

When Instant Start is enabled, the visibility of voice_search_button is
set pre-native. However, TasksSurfaceMediator#initWithNative()
overwrites this value. In this CL, we move setting the default value of
IS_VOICE_RECOGNITION_BUTTON_VISIBLE to the constructor of
TasksSurfaceMediator.

Bug: 1139026
Change-Id: I08fb94576a665975279ace075a6fa6b86874a30f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2523441
Commit-Queue: Xi Han <hanxi@chromium.org>
Reviewed-by: default avatarWei-Yin Chen (陳威尹) <wychen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826493}
parent 786f10ee
......@@ -720,7 +720,7 @@ public class InstantStartTest {
ChromeRenderTestRule.sanitize(surface);
// TODO(crbug.com/1065314): fix favicon.
mRenderTestRule.render(
surface, "singlePane_singleTab_noMV3" + (isFeedV2 ? "_FeedV2" : "_FeedV1"));
surface, "singlePane_singleTab_noMV4" + (isFeedV2 ? "_FeedV2" : "_FeedV1"));
// Initializes native.
startAndWaitNativeInitialization();
......
......@@ -1339,6 +1339,47 @@ public class StartSurfaceTest {
assertEquals(4, cta.getTabModelSelector().getCurrentModel().getCount());
assertEquals(1, filter.getTabGroupCount());
}
@Test
@MediumTest
@Feature({"StartSurface"})
// clang-format off
@CommandLineFlags.Add({BASE_PARAMS + "/single/exclude_mv_tiles/true"
+ "/show_last_active_tab_only/true/show_stack_tab_switcher/true"})
public void testShow_SingleAsHomepageV2_VoiceSearchButtonShown() {
// clang-format on
if (!mImmediateReturn) {
onView(withId(org.chromium.chrome.tab_ui.R.id.home_button)).perform(click());
}
CriteriaHelper.pollUiThread(
()
-> mActivityTestRule.getActivity().getLayoutManager() != null
&& mActivityTestRule.getActivity().getLayoutManager().overviewVisible());
onView(withId(R.id.primary_tasks_surface_view)).check(matches(isDisplayed()));
onView(withId(R.id.search_box_text)).check(matches(isDisplayed()));
onView(withId(R.id.voice_search_button)).check(matches(isDisplayed()));
}
@Test
@MediumTest
@Feature({"StartSurface"})
@CommandLineFlags.Add({BASE_PARAMS + "/single"})
public void testShow_SingleAsHomepage_VoiceSearchButtonShown() {
if (!mImmediateReturn) {
onView(withId(org.chromium.chrome.tab_ui.R.id.home_button)).perform(click());
}
CriteriaHelper.pollUiThread(
()
-> mActivityTestRule.getActivity().getLayoutManager() != null
&& mActivityTestRule.getActivity().getLayoutManager().overviewVisible());
onView(withId(R.id.primary_tasks_surface_view)).check(matches(isDisplayed()));
onView(withId(R.id.search_box_text)).check(matches(isDisplayed()));
onView(withId(R.id.voice_search_button)).check(matches(isDisplayed()));
}
}
// TODO(crbug.com/1033909): Add more integration tests.
......@@ -60,6 +60,8 @@ class TasksSurfaceMediator implements OverviewModeObserver {
// Set the initial state.
mModel.set(IS_SURFACE_BODY_VISIBLE, true);
mModel.set(IS_FAKE_SEARCH_BOX_VISIBLE, true);
mModel.set(IS_VOICE_RECOGNITION_BUTTON_VISIBLE, false);
}
public void initWithNative(FakeboxDelegate fakeboxDelegate) {
......@@ -112,10 +114,6 @@ class TasksSurfaceMediator implements OverviewModeObserver {
mModel.set(
INCOGNITO_COOKIE_CONTROLS_TOGGLE_CHECKED_LISTENER, mIncognitoCookieControlsManager);
mModel.set(INCOGNITO_COOKIE_CONTROLS_ICON_CLICK_LISTENER, mIncognitoCookieControlsManager);
// Set the initial state.
mModel.set(IS_FAKE_SEARCH_BOX_VISIBLE, true);
mModel.set(IS_VOICE_RECOGNITION_BUTTON_VISIBLE, false);
}
/**
......
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