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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java

Issue 1255583002: Move AppMenuTest from ChromeShellTest to ChromePublicTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/appmenu/AppMenuTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java
index 3f6b891bee4cb8e5d2ae5bcf95e1221b9c40cb41..d2f6fe913aec28943f3b2ebadde350be876367e1 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java
@@ -138,6 +138,17 @@ public abstract class ChromeActivity extends AsyncInitializationActivity
implements TabCreatorManager, AccessibilityStateChangeListener, PolicyChangeListener,
ContextualSearchTabPromotionDelegate, SnackbarManageable, SceneChangeObserver {
/**
+ * Factory which creates the AppMenuHandler.
+ */
+ public interface AppMenuHandlerFactory {
+ /**
+ * @return AppMenuHandler for the given activity and menu resource id.
+ */
+ public AppMenuHandler get(Activity activity,
+ AppMenuPropertiesDelegate delegate, int menuResourceId);
+ }
+
+ /**
* No control container to inflate during initialization.
*/
private static final int NO_CONTROL_CONTAINER = -1;
@@ -199,6 +210,22 @@ public abstract class ChromeActivity extends AsyncInitializationActivity
private final Locale mCurrentLocale = Locale.getDefault();
+ private static AppMenuHandlerFactory sAppMenuHandlerFactory = new AppMenuHandlerFactory() {
+ @Override
+ public AppMenuHandler get(
+ Activity activity, AppMenuPropertiesDelegate delegate, int menuResourceId) {
+ return new AppMenuHandler(activity, delegate, menuResourceId);
+ }
+ };
+
+ /**
+ * @param The {@link AppMenuHandlerFactory} for creating {@link mAppMenuHandler}
+ */
+ @VisibleForTesting
+ public static void setAppMenuHandlerFactoryForTesting(AppMenuHandlerFactory factory) {
+ sAppMenuHandlerFactory = factory;
+ }
+
@Override
public void preInflationStartup() {
super.preInflationStartup();
@@ -320,8 +347,8 @@ public abstract class ChromeActivity extends AsyncInitializationActivity
assert controlContainer != null;
ToolbarControlContainer toolbarContainer = (ToolbarControlContainer) controlContainer;
mAppMenuPropertiesDelegate = createAppMenuPropertiesDelegate();
- mAppMenuHandler = new AppMenuHandler(this,
- mAppMenuPropertiesDelegate, getAppMenuLayoutId());
+ mAppMenuHandler = sAppMenuHandlerFactory.get(this, mAppMenuPropertiesDelegate,
+ getAppMenuLayoutId());
mToolbarManager = new ToolbarManager(this, toolbarContainer, mAppMenuHandler,
mAppMenuPropertiesDelegate, getCompositorViewHolder().getInvalidator());
mAppMenuHandler.addObserver(new AppMenuObserver() {
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/appmenu/AppMenuTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698