| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.test.util.browser.tabmodel; | 5 package org.chromium.chrome.test.util.browser.tabmodel; |
| 6 | 6 |
| 7 import org.chromium.chrome.browser.tab.Tab; | 7 import org.chromium.chrome.browser.tab.Tab; |
| 8 import org.chromium.chrome.browser.tabmodel.TabModel; | 8 import org.chromium.chrome.browser.tabmodel.TabModel; |
| 9 import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType; | 9 import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType; |
| 10 import org.chromium.chrome.browser.tabmodel.TabModelSelector; | 10 import org.chromium.chrome.browser.tabmodel.TabModelSelector; |
| 11 import org.chromium.chrome.browser.tabmodel.TabModelSelectorBase; | 11 import org.chromium.chrome.browser.tabmodel.TabModelSelectorBase; |
| 12 import org.chromium.chrome.browser.tabmodel.TabModelUtils; | 12 import org.chromium.chrome.browser.tabmodel.TabModelUtils; |
| 13 import org.chromium.content_public.browser.LoadUrlParams; | 13 import org.chromium.content_public.browser.LoadUrlParams; |
| 14 | 14 |
| 15 /** | 15 /** |
| 16 * Mock of a basic {@link TabModelSelector}. It supports 2 {@link TabModel}: sta
ndard and incognito. | 16 * Mock of a basic {@link TabModelSelector}. It supports 2 {@link TabModel}: sta
ndard and incognito. |
| 17 */ | 17 */ |
| 18 public class MockTabModelSelector extends TabModelSelectorBase { | 18 public class MockTabModelSelector extends TabModelSelectorBase { |
| 19 // Offsetting the id compared to the index helps greatly when debugging. | 19 // Offsetting the id compared to the index helps greatly when debugging. |
| 20 public static final int ID_OFFSET = 100000; | 20 public static final int ID_OFFSET = 100000; |
| 21 public static final int INCOGNITO_ID_OFFSET = 200000; | 21 public static final int INCOGNITO_ID_OFFSET = 200000; |
| 22 private static int sCurTabOffset = 0; | 22 private static int sCurTabOffset; |
| 23 | 23 |
| 24 public MockTabModelSelector( | 24 public MockTabModelSelector( |
| 25 int tabCount, int incognitoTabCount, MockTabModel.MockTabModelDelega
te delegate) { | 25 int tabCount, int incognitoTabCount, MockTabModel.MockTabModelDelega
te delegate) { |
| 26 super(); | 26 super(); |
| 27 initialize(false, new MockTabModel(false, delegate), new MockTabModel(tr
ue, delegate)); | 27 initialize(false, new MockTabModel(false, delegate), new MockTabModel(tr
ue, delegate)); |
| 28 for (int i = 0; i < tabCount; i++) { | 28 for (int i = 0; i < tabCount; i++) { |
| 29 addMockTab(); | 29 addMockTab(); |
| 30 } | 30 } |
| 31 if (tabCount > 0) TabModelUtils.setIndex(getModelAt(0), 0); | 31 if (tabCount > 0) TabModelUtils.setIndex(getModelAt(0), 0); |
| 32 | 32 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 57 @Override | 57 @Override |
| 58 public void closeAllTabs() { | 58 public void closeAllTabs() { |
| 59 throw new UnsupportedOperationException(); | 59 throw new UnsupportedOperationException(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 @Override | 62 @Override |
| 63 public int getTotalTabCount() { | 63 public int getTotalTabCount() { |
| 64 throw new UnsupportedOperationException(); | 64 throw new UnsupportedOperationException(); |
| 65 } | 65 } |
| 66 } | 66 } |
| OLD | NEW |