| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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; | 5 package org.chromium.chrome.test.util; |
| 6 | 6 |
| 7 import android.app.Instrumentation; | 7 import android.app.Instrumentation; |
| 8 import android.text.TextUtils; | 8 import android.text.TextUtils; |
| 9 | 9 |
| 10 import org.junit.Assert; | 10 import org.junit.Assert; |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 final CallbackHelper createdCallback = new CallbackHelper(); | 258 final CallbackHelper createdCallback = new CallbackHelper(); |
| 259 normalTabModel.addObserver( | 259 normalTabModel.addObserver( |
| 260 new EmptyTabModelObserver() { | 260 new EmptyTabModelObserver() { |
| 261 @Override | 261 @Override |
| 262 public void didAddTab(Tab tab, TabLaunchType type) { | 262 public void didAddTab(Tab tab, TabLaunchType type) { |
| 263 createdCallback.notifyCalled(); | 263 createdCallback.notifyCalled(); |
| 264 normalTabModel.removeObserver(this); | 264 normalTabModel.removeObserver(this); |
| 265 } | 265 } |
| 266 }); | 266 }); |
| 267 // Tablet and phone have different new tab buttons; click the right one. | 267 // Tablet and phone have different new tab buttons; click the right one. |
| 268 if (DeviceFormFactor.isTablet(activity)) { | 268 if (DeviceFormFactor.isTablet()) { |
| 269 StripLayoutHelper strip = | 269 StripLayoutHelper strip = |
| 270 TabStripUtils.getStripLayoutHelper(activity, false /* incogn
ito */); | 270 TabStripUtils.getStripLayoutHelper(activity, false /* incogn
ito */); |
| 271 CompositorButton newTabButton = strip.getNewTabButton(); | 271 CompositorButton newTabButton = strip.getNewTabButton(); |
| 272 TabStripUtils.clickCompositorButton(newTabButton, instrumentation, a
ctivity); | 272 TabStripUtils.clickCompositorButton(newTabButton, instrumentation, a
ctivity); |
| 273 instrumentation.waitForIdleSync(); | 273 instrumentation.waitForIdleSync(); |
| 274 } else { | 274 } else { |
| 275 TouchCommon.singleClickView(activity.findViewById(R.id.new_tab_butto
n)); | 275 TouchCommon.singleClickView(activity.findViewById(R.id.new_tab_butto
n)); |
| 276 } | 276 } |
| 277 | 277 |
| 278 try { | 278 try { |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 @Override | 548 @Override |
| 549 public void run() { | 549 public void run() { |
| 550 TabModelSelector selector = activity.getTabModelSelector(); | 550 TabModelSelector selector = activity.getTabModelSelector(); |
| 551 for (TabModel tabModel : selector.getModels()) { | 551 for (TabModel tabModel : selector.getModels()) { |
| 552 tabModel.removeObserver(observer); | 552 tabModel.removeObserver(observer); |
| 553 } | 553 } |
| 554 } | 554 } |
| 555 }); | 555 }); |
| 556 } | 556 } |
| 557 } | 557 } |
| OLD | NEW |