| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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.permissions; | 5 package org.chromium.chrome.browser.permissions; |
| 6 | 6 |
| 7 import android.content.DialogInterface; | 7 import android.content.DialogInterface; |
| 8 import android.support.v7.app.AlertDialog; | 8 import android.support.v7.app.AlertDialog; |
| 9 import android.support.v7.widget.SwitchCompat; | 9 import android.support.v7.widget.SwitchCompat; |
| 10 | 10 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 } | 184 } |
| 185 } | 185 } |
| 186 | 186 |
| 187 /** | 187 /** |
| 188 * Replies to an infobar permission prompt, optionally checking for the pres
ence of a | 188 * Replies to an infobar permission prompt, optionally checking for the pres
ence of a |
| 189 * persistence switch and toggling it. Waits for a provided number of update
s to the page title | 189 * persistence switch and toggling it. Waits for a provided number of update
s to the page title |
| 190 * in response. | 190 * in response. |
| 191 */ | 191 */ |
| 192 private void replyToInfoBarAndWaitForUpdates(PermissionUpdateWaiter updateWa
iter, int nUpdates, | 192 private void replyToInfoBarAndWaitForUpdates(PermissionUpdateWaiter updateWa
iter, int nUpdates, |
| 193 boolean allow, boolean hasSwitch, boolean toggleSwitch) throws Excep
tion { | 193 boolean allow, boolean hasSwitch, boolean toggleSwitch) throws Excep
tion { |
| 194 assertTrue("InfoBar not added.", mListener.addInfoBarAnimationFinished()
); | 194 mListener.addInfoBarAnimationFinished("InfoBar not added."); |
| 195 InfoBar infobar = getInfoBars().get(0); | 195 InfoBar infobar = getInfoBars().get(0); |
| 196 assertNotNull(infobar); | 196 assertNotNull(infobar); |
| 197 | 197 |
| 198 if (hasSwitch) { | 198 if (hasSwitch) { |
| 199 SwitchCompat persistSwitch = (SwitchCompat) infobar.getView().findVi
ewById( | 199 SwitchCompat persistSwitch = (SwitchCompat) infobar.getView().findVi
ewById( |
| 200 R.id.permission_infobar_persist_toggle); | 200 R.id.permission_infobar_persist_toggle); |
| 201 assertNotNull(persistSwitch); | 201 assertNotNull(persistSwitch); |
| 202 assertTrue(persistSwitch.isChecked()); | 202 assertTrue(persistSwitch.isChecked()); |
| 203 if (toggleSwitch) { | 203 if (toggleSwitch) { |
| 204 singleClickView(persistSwitch); | 204 singleClickView(persistSwitch); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 return persistSwitch.isChecked(); | 252 return persistSwitch.isChecked(); |
| 253 } | 253 } |
| 254 })); | 254 })); |
| 255 } | 255 } |
| 256 | 256 |
| 257 @Override | 257 @Override |
| 258 public void startMainActivity() throws InterruptedException { | 258 public void startMainActivity() throws InterruptedException { |
| 259 startMainActivityOnBlankPage(); | 259 startMainActivityOnBlankPage(); |
| 260 } | 260 } |
| 261 } | 261 } |
| OLD | NEW |