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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java

Issue 1426683005: [Contextual Search] Improve testing & add regressions tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync & rebase Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java
index 390bf363b09a702d5aa4cb5fe3e0d078111e4f76..7af52d2a42ee05294961db130a369d3d0a15bd84 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java
@@ -810,8 +810,6 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
* @param reason The reason for a change in the panel's state.
*/
public void setPanelState(PanelState state, StateChangeReason reason) {
- mPanelState = state;
-
if (state == PanelState.CLOSED) {
mIsShowing = false;
onClosed(reason);
@@ -819,6 +817,12 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
|| (state == PanelState.MAXIMIZED && !isFullscreenSizePanel())) {
showPromoViewAtYPosition(getPromoYPx());
}
+
+ // We should only set the state at the end of this method, in oder to make sure that
+ // all callbacks will be fired before changing the state of the Panel. This prevents
+ // some flakiness on tests since they rely on changes of state to determine when a
+ // particular action has been completed.
+ mPanelState = state;
}
/**

Powered by Google App Engine
This is Rietveld 408576698