Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(365)

Side by Side Diff: chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/OmniboxTest.java

Issue 1988553002: Android omnibox: Force paragraph direction to LTR. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Set alignment correctly, and URLs in SuggestionView match URL bar. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.browser.omnibox; 5 package org.chromium.chrome.browser.omnibox;
6 6
7 import static org.chromium.chrome.test.util.OmniboxTestUtils.buildSuggestionMap; 7 import static org.chromium.chrome.test.util.OmniboxTestUtils.buildSuggestionMap;
8 8
9 import android.os.Environment; 9 import android.os.Environment;
10 import android.os.SystemClock; 10 import android.os.SystemClock;
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 urlBarView.requestFocus(); 650 urlBarView.requestFocus();
651 urlBarView.setText(""); 651 urlBarView.setText("");
652 } 652 }
653 }); 653 });
654 654
655 final LocationBarLayout locationBar = 655 final LocationBarLayout locationBar =
656 ((LocationBarLayout) getActivity().findViewById(R.id.location_ba r)); 656 ((LocationBarLayout) getActivity().findViewById(R.id.location_ba r));
657 657
658 Map<String, List<SuggestionsResult>> suggestionsMap = buildSuggestionMap ( 658 Map<String, List<SuggestionsResult>> suggestionsMap = buildSuggestionMap (
659 new TestSuggestionResultsBuilder() 659 new TestSuggestionResultsBuilder()
660 .setTextShownFor("ل")
661 .addSuggestions(new SuggestionsResultBuilder()
662 .addGeneratedSuggestion(OmniboxSuggestionType.SE ARCH_HISTORY,
663 "للك", null)
664 .addGeneratedSuggestion(OmniboxSuggestionType.SE ARCH_HISTORY,
665 "www.test.com", null)
666 .addGeneratedSuggestion(OmniboxSuggestionType.SE ARCH_HISTORY,
667 "للكتا", null)),
668 new TestSuggestionResultsBuilder()
669 .setTextShownFor("للك") 660 .setTextShownFor("للك")
670 .addSuggestions(new SuggestionsResultBuilder() 661 .addSuggestions(new SuggestionsResultBuilder()
671 .addGeneratedSuggestion(OmniboxSuggestionType.SE ARCH_HISTORY, 662 .addGeneratedSuggestion(OmniboxSuggestionType.SE ARCH_HISTORY,
672 "للكتاب", null)), 663 "للكتاب", null)),
673 new TestSuggestionResultsBuilder() 664 new TestSuggestionResultsBuilder()
674 .setTextShownFor("f") 665 .setTextShownFor("f")
675 .addSuggestions(new SuggestionsResultBuilder() 666 .addSuggestions(new SuggestionsResultBuilder()
676 .addGeneratedSuggestion(OmniboxSuggestionType.SE ARCH_HISTORY, 667 .addGeneratedSuggestion(OmniboxSuggestionType.SE ARCH_HISTORY,
677 "f", null) 668 "f", null)
678 .addGeneratedSuggestion(OmniboxSuggestionType.SE ARCH_HISTORY, 669 .addGeneratedSuggestion(OmniboxSuggestionType.SE ARCH_HISTORY,
679 "fa", null) 670 "fa", null)
680 .addGeneratedSuggestion(OmniboxSuggestionType.SE ARCH_HISTORY, 671 .addGeneratedSuggestion(OmniboxSuggestionType.SE ARCH_HISTORY,
681 "fac", null))); 672 "fac", null)));
682 final TestAutocompleteController controller = new TestAutocompleteContro ller( 673 final TestAutocompleteController controller = new TestAutocompleteContro ller(
683 locationBar, locationBar, suggestionsMap); 674 locationBar, locationBar, suggestionsMap);
684 675
685 ThreadUtils.runOnUiThreadBlocking(new Runnable() { 676 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
686 @Override 677 @Override
687 public void run() { 678 public void run() {
688 locationBar.setAutocompleteController(controller); 679 locationBar.setAutocompleteController(controller);
689 } 680 }
690 }); 681 });
691 682
692 ThreadUtils.runOnUiThreadBlocking(new Runnable() { 683 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
693 @Override 684 @Override
694 public void run() { 685 public void run() {
695 urlBarView.setText("ل");
696 }
697 });
698 verifyOmniboxSuggestionAlignment(locationBar, 3, View.LAYOUT_DIRECTION_R TL);
699
700 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
701 @Override
702 public void run() {
703 urlBarView.setText("للك"); 686 urlBarView.setText("للك");
704 } 687 }
705 }); 688 });
706 verifyOmniboxSuggestionAlignment(locationBar, 1, View.LAYOUT_DIRECTION_R TL); 689 // Always LTR, even if both the entered text and the suggestions are RTL strings.
690 verifyOmniboxSuggestionAlignment(locationBar, 1, View.LAYOUT_DIRECTION_L TR);
707 691
708 ThreadUtils.runOnUiThreadBlocking(new Runnable() { 692 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
709 @Override 693 @Override
710 public void run() { 694 public void run() {
711 urlBarView.setText("f"); 695 urlBarView.setText("f");
712 } 696 }
713 }); 697 });
714 verifyOmniboxSuggestionAlignment(locationBar, 3, View.LAYOUT_DIRECTION_L TR); 698 verifyOmniboxSuggestionAlignment(locationBar, 3, View.LAYOUT_DIRECTION_L TR);
715 } 699 }
716 700
(...skipping 22 matching lines...) Expand all
739 723
740 @Override 724 @Override
741 public void startMainActivity() throws InterruptedException { 725 public void startMainActivity() throws InterruptedException {
742 if (getName().equals("testsplitPathFromUrlDisplayText") 726 if (getName().equals("testsplitPathFromUrlDisplayText")
743 || getName().equals("testDefaultText")) { 727 || getName().equals("testDefaultText")) {
744 return; 728 return;
745 } 729 }
746 startMainActivityOnBlankPage(); 730 startMainActivityOnBlankPage();
747 } 731 }
748 } 732 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698