| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.content.browser; | 5 package org.chromium.content.browser; |
| 6 | 6 |
| 7 import android.content.ClipData; | 7 import android.content.ClipData; |
| 8 import android.content.ClipboardManager; | 8 import android.content.ClipboardManager; |
| 9 import android.content.Context; | 9 import android.content.Context; |
| 10 import android.support.test.filters.LargeTest; | 10 import android.support.test.filters.LargeTest; |
| 11 import android.text.TextUtils; | 11 import android.text.TextUtils; |
| 12 | 12 |
| 13 import org.chromium.base.ThreadUtils; | 13 import org.chromium.base.ThreadUtils; |
| 14 import org.chromium.base.test.util.Feature; | 14 import org.chromium.base.test.util.Feature; |
| 15 import org.chromium.base.test.util.UrlUtils; | 15 import org.chromium.base.test.util.UrlUtils; |
| 16 import org.chromium.content.browser.test.util.Criteria; | 16 import org.chromium.content.browser.test.util.Criteria; |
| 17 import org.chromium.content.browser.test.util.CriteriaHelper; | 17 import org.chromium.content.browser.test.util.CriteriaHelper; |
| 18 import org.chromium.content_public.browser.WebContents; | 18 import org.chromium.content_public.browser.WebContents; |
| 19 import org.chromium.content_shell_apk.ContentShellActivityTestRule.RerunWithUpda
tedContainerView; |
| 19 import org.chromium.content_shell_apk.ContentShellTestBase; | 20 import org.chromium.content_shell_apk.ContentShellTestBase; |
| 20 | 21 |
| 21 /** | 22 /** |
| 22 * Tests rich text clipboard functionality. | 23 * Tests rich text clipboard functionality. |
| 23 */ | 24 */ |
| 24 public class ClipboardTest extends ContentShellTestBase { | 25 public class ClipboardTest extends ContentShellTestBase { |
| 25 private static final String TEST_PAGE_DATA_URL = UrlUtils.encodeHtmlDataUri( | 26 private static final String TEST_PAGE_DATA_URL = UrlUtils.encodeHtmlDataUri( |
| 26 "<html><body>Hello, <a href=\"http://www.example.com/\">world</a>, h
ow <b> " | 27 "<html><body>Hello, <a href=\"http://www.example.com/\">world</a>, h
ow <b> " |
| 27 + "Chromium</b> doing today?</body></html>"); | 28 + "Chromium</b> doing today?</body></html>"); |
| 28 | 29 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 // Returns whether there is a primary clip with content on the current clipb
oard. | 99 // Returns whether there is a primary clip with content on the current clipb
oard. |
| 99 private Boolean hasPrimaryClip(ClipboardManager clipboardManager) { | 100 private Boolean hasPrimaryClip(ClipboardManager clipboardManager) { |
| 100 final ClipData clip = clipboardManager.getPrimaryClip(); | 101 final ClipData clip = clipboardManager.getPrimaryClip(); |
| 101 if (clip != null && clip.getItemCount() > 0) { | 102 if (clip != null && clip.getItemCount() > 0) { |
| 102 return !TextUtils.isEmpty(clip.getItemAt(0).getText()); | 103 return !TextUtils.isEmpty(clip.getItemAt(0).getText()); |
| 103 } | 104 } |
| 104 | 105 |
| 105 return false; | 106 return false; |
| 106 } | 107 } |
| 107 } | 108 } |
| OLD | NEW |