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

Unified Diff: chrome/test/android/javatests/src/org/chromium/chrome/test/util/TabBaseTabUtils.java

Issue 148523013: [Android] Rename TabBase to Tab (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2014_01_22_tabbase
Patch Set: sync Created 6 years, 10 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/test/android/javatests/src/org/chromium/chrome/test/util/TabBaseTabUtils.java
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/TabBaseTabUtils.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/TabBaseTabUtils.java
deleted file mode 100644
index abc74c6390996cd2e61037952de177c5c4650212..0000000000000000000000000000000000000000
--- a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/TabBaseTabUtils.java
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.chrome.test.util;
-
-import android.view.ContextMenu;
-
-import org.chromium.chrome.browser.EmptyTabObserver;
-import org.chromium.chrome.browser.TabBase;
-import org.chromium.content.browser.ContentViewClient;
-import org.chromium.content.browser.test.util.CallbackHelper;
-import org.chromium.content.browser.test.util.TestCallbackHelperContainer;
-import org.chromium.content.browser.test.util.TestContentViewClient;
-import org.chromium.content.browser.test.util.TestContentViewClientWrapper;
-import org.chromium.content.browser.test.util.TestWebContentsObserver;
-
-import java.lang.ref.WeakReference;
-
-/**
- * A utility class that contains methods generic to all Tabs tests.
- */
-public class TabBaseTabUtils {
- private static TestContentViewClient createTestContentViewClientForTab(TabBase tab) {
- ContentViewClient client = tab.getContentView().getContentViewClient();
- if (client instanceof TestContentViewClient) return (TestContentViewClient) client;
-
- TestContentViewClient testClient = new TestContentViewClientWrapper(client);
- tab.getContentView().setContentViewClient(testClient);
- return testClient;
- }
-
- public static class TestCallbackHelperContainerForTab extends TestCallbackHelperContainer {
- private final OnCloseTabHelper mOnCloseTabHelper;
- private final OnContextMenuShownHelper mOnContextMenuShownHelper;
-
- public TestCallbackHelperContainerForTab(TabBase tab) {
- super(createTestContentViewClientForTab(tab),
- new TestWebContentsObserver(tab.getContentView().getContentViewCore()));
- mOnCloseTabHelper = new OnCloseTabHelper();
- mOnContextMenuShownHelper = new OnContextMenuShownHelper();
- tab.addObserver(new EmptyTabObserver() {
- @Override
- public void onDestroyed(TabBase tab) {
- mOnCloseTabHelper.notifyCalled();
- }
-
- @Override
- public void onContextMenuShown(TabBase tab, ContextMenu menu) {
- mOnContextMenuShownHelper.notifyCalled(menu);
- }
- });
- }
-
- public static class OnCloseTabHelper extends CallbackHelper {
- }
-
- public static class OnContextMenuShownHelper extends CallbackHelper {
- private WeakReference<ContextMenu> mContextMenu;
-
- public void notifyCalled(ContextMenu menu) {
- mContextMenu = new WeakReference<ContextMenu>(menu);
- notifyCalled();
- }
-
- public ContextMenu getContextMenu() {
- assert getCallCount() > 0;
- return mContextMenu.get();
- }
- }
-
- public OnCloseTabHelper getOnCloseTabHelper() {
- return mOnCloseTabHelper;
- }
-
- public OnContextMenuShownHelper getOnContextMenuShownHelper() {
- return mOnContextMenuShownHelper;
- }
- }
-
- /**
- * Creates, binds and returns a TestCallbackHelperContainer for a given Tab.
- */
- public static TestCallbackHelperContainerForTab getTestCallbackHelperContainer(TabBase tab) {
- return tab == null ? null : new TestCallbackHelperContainerForTab(tab);
- }
-}
« no previous file with comments | « chrome/chrome_browser.gypi ('k') | chrome/test/android/javatests/src/org/chromium/chrome/test/util/TabUtils.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698