OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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.browser.payments; | 5 package org.chromium.chrome.browser.payments; |
6 | 6 |
7 import static java.util.Arrays.asList; | 7 import static java.util.Arrays.asList; |
8 | 8 |
9 import android.os.Handler; | 9 import android.os.Handler; |
10 import android.view.KeyEvent; | 10 import android.view.KeyEvent; |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 @Override | 331 @Override |
332 public String call() { | 332 public String call() { |
333 return ((OptionSection) mUI.getPaymentMethodSectionForTest()) | 333 return ((OptionSection) mUI.getPaymentMethodSectionForTest()) |
334 .getOptionLabelsForTest(index) | 334 .getOptionLabelsForTest(index) |
335 .getText() | 335 .getText() |
336 .toString(); | 336 .toString(); |
337 } | 337 } |
338 }); | 338 }); |
339 } | 339 } |
340 | 340 |
| 341 protected String getSelectedPaymentInstrumentLabel() throws ExecutionExcepti
on { |
| 342 return ThreadUtils.runOnUiThreadBlocking(new Callable<String>() { |
| 343 @Override |
| 344 public String call() { |
| 345 OptionSection section = ((OptionSection) mUI.getPaymentMethodSec
tionForTest()); |
| 346 int size = section.getNumberOfOptionLabelsForTest(); |
| 347 for (int i = 0; i < size; i++) { |
| 348 if (section.getOptionRowAtIndex(i).isChecked()) { |
| 349 return section.getOptionRowAtIndex(i).getLabelText().toS
tring(); |
| 350 } |
| 351 } |
| 352 return null; |
| 353 } |
| 354 }); |
| 355 } |
| 356 |
| 357 protected String getOrderSummaryTotal() throws ExecutionException { |
| 358 return ThreadUtils.runOnUiThreadBlocking(new Callable<String>() { |
| 359 @Override |
| 360 public String call() { |
| 361 return mUI.getOrderSummaryTotalTextViewForTest().getText().toStr
ing(); |
| 362 } |
| 363 }); |
| 364 } |
| 365 |
341 protected String getContactDetailsSuggestionLabel(final int suggestionIndex) | 366 protected String getContactDetailsSuggestionLabel(final int suggestionIndex) |
342 throws ExecutionException { | 367 throws ExecutionException { |
343 return ThreadUtils.runOnUiThreadBlocking(new Callable<String>() { | 368 return ThreadUtils.runOnUiThreadBlocking(new Callable<String>() { |
344 @Override | 369 @Override |
345 public String call() { | 370 public String call() { |
346 return ((OptionSection) mUI.getContactDetailsSectionForTest()) | 371 return ((OptionSection) mUI.getContactDetailsSectionForTest()) |
347 .getOptionLabelsForTest(suggestionIndex) | 372 .getOptionLabelsForTest(suggestionIndex) |
348 .getText() | 373 .getText() |
349 .toString(); | 374 .toString(); |
350 } | 375 } |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 } | 981 } |
957 | 982 |
958 public interface PaymentRequestTestCommonCallback { | 983 public interface PaymentRequestTestCommonCallback { |
959 ChromeTabbedActivity getActivity(); | 984 ChromeTabbedActivity getActivity(); |
960 void onMainActivityStarted() | 985 void onMainActivityStarted() |
961 throws InterruptedException, ExecutionException, TimeoutExceptio
n; | 986 throws InterruptedException, ExecutionException, TimeoutExceptio
n; |
962 void startMainActivityWithURL(String url) throws InterruptedException; | 987 void startMainActivityWithURL(String url) throws InterruptedException; |
963 void assertWaitForPageScaleFactorMatch(float expectedScale); | 988 void assertWaitForPageScaleFactorMatch(float expectedScale); |
964 } | 989 } |
965 } | 990 } |
OLD | NEW |