Commit e8d6fd19 authored by Darren Shen's avatar Darren Shen Committed by Commit Bot

ime: Use chromeos namespace in NativeInputMethodEngine browser tests.

Impl & Test usually use the same namespace. NativeInputMethodEngine uses
the chromeos namespace, so use the same namespace for the test file.

Bug: 1148157
Change-Id: Idde400dcb320c8da1dc89335db8e734f4ec695b2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2532485Reviewed-by: default avatarJing Wang <jiwan@chromium.org>
Commit-Queue: Darren Shen <shend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827679}
parent 8e829fc5
...@@ -45,8 +45,7 @@ ...@@ -45,8 +45,7 @@
#include "ui/events/keycodes/keyboard_codes.h" #include "ui/events/keycodes/keyboard_codes.h"
#include "ui/events/keycodes/keyboard_codes_posix.h" #include "ui/events/keycodes/keyboard_codes_posix.h"
using chromeos::InputMethodEngineBase; namespace chromeos {
namespace { namespace {
constexpr char kEmojiData[] = "happy,😀;😃;😄"; constexpr char kEmojiData[] = "happy,😀;😃;😄";
...@@ -142,16 +141,16 @@ class NativeInputMethodEngineTest : public InProcessBrowserTest, ...@@ -142,16 +141,16 @@ class NativeInputMethodEngineTest : public InProcessBrowserTest,
public: public:
NativeInputMethodEngineTest() : input_method_(this) { NativeInputMethodEngineTest() : input_method_(this) {
feature_list_.InitWithFeatures( feature_list_.InitWithFeatures(
/*enabled_features=*/{chromeos::features::kAssistPersonalInfo, /*enabled_features=*/{features::kAssistPersonalInfo,
chromeos::features::kAssistPersonalInfoEmail, features::kAssistPersonalInfoEmail,
chromeos::features::kAssistPersonalInfoName, features::kAssistPersonalInfoName,
chromeos::features::kEmojiSuggestAddition}, features::kEmojiSuggestAddition},
/*disabled_features=*/{}); /*disabled_features=*/{});
} }
protected: protected:
void SetUp() override { void SetUp() override {
chromeos::ime::FakeEngineMainEntryForTesting(nullptr); ime::FakeEngineMainEntryForTesting(nullptr);
mojo::core::Init(); mojo::core::Init();
InProcessBrowserTest::SetUp(); InProcessBrowserTest::SetUp();
ui::IMEBridge::Initialize(); ui::IMEBridge::Initialize();
...@@ -166,7 +165,7 @@ class NativeInputMethodEngineTest : public InProcessBrowserTest, ...@@ -166,7 +165,7 @@ class NativeInputMethodEngineTest : public InProcessBrowserTest,
profile_ = browser()->profile(); profile_ = browser()->profile();
prefs_ = profile_->GetPrefs(); prefs_ = profile_->GetPrefs();
prefs_->Set(prefs::kLanguageInputMethodSpecificSettings, prefs_->Set(::prefs::kLanguageInputMethodSpecificSettings,
base::DictionaryValue()); base::DictionaryValue());
engine_.Initialize(std::move(observer), "", profile_); engine_.Initialize(std::move(observer), "", profile_);
engine_.get_assistive_suggester_for_testing() engine_.get_assistive_suggester_for_testing()
...@@ -177,7 +176,7 @@ class NativeInputMethodEngineTest : public InProcessBrowserTest, ...@@ -177,7 +176,7 @@ class NativeInputMethodEngineTest : public InProcessBrowserTest,
void TearDown() override { engine_.Reset(); } void TearDown() override { engine_.Reset(); }
void SetUpTextInput(chromeos::TextInputTestHelper& helper) { void SetUpTextInput(TextInputTestHelper& helper) {
GURL url = ui_test_utils::GetTestUrl( GURL url = ui_test_utils::GetTestUrl(
base::FilePath(FILE_PATH_LITERAL("textinput")), base::FilePath(FILE_PATH_LITERAL("textinput")),
base::FilePath(FILE_PATH_LITERAL("simple_textarea.html"))); base::FilePath(FILE_PATH_LITERAL("simple_textarea.html")));
...@@ -230,7 +229,7 @@ class NativeInputMethodEngineTest : public InProcessBrowserTest, ...@@ -230,7 +229,7 @@ class NativeInputMethodEngineTest : public InProcessBrowserTest,
return browser()->window()->GetNativeWindow()->GetHost()->GetInputMethod(); return browser()->window()->GetNativeWindow()->GetHost()->GetInputMethod();
} }
chromeos::NativeInputMethodEngine engine_; NativeInputMethodEngine engine_;
Profile* profile_; Profile* profile_;
PrefService* prefs_; PrefService* prefs_;
TestObserver* observer_; TestObserver* observer_;
...@@ -351,7 +350,7 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, SuggestUserEmail) { ...@@ -351,7 +350,7 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, SuggestUserEmail) {
engine_.Enable(kEngineIdUs); engine_.Enable(kEngineIdUs);
chromeos::TextInputTestHelper helper(GetBrowserInputMethod()); TextInputTestHelper helper(GetBrowserInputMethod());
SetUpTextInput(helper); SetUpTextInput(helper);
const base::string16 prefix_text = base::UTF8ToUTF16("my email is "); const base::string16 prefix_text = base::UTF8ToUTF16("my email is ");
...@@ -361,11 +360,9 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, SuggestUserEmail) { ...@@ -361,11 +360,9 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, SuggestUserEmail) {
helper.GetTextInputClient()->InsertText(prefix_text); helper.GetTextInputClient()->InsertText(prefix_text);
helper.WaitForSurroundingTextChanged(prefix_text); helper.WaitForSurroundingTextChanged(prefix_text);
histogram_tester.ExpectUniqueSample("InputMethod.Assistive.Match", histogram_tester.ExpectUniqueSample("InputMethod.Assistive.Match",
chromeos::AssistiveType::kPersonalEmail, AssistiveType::kPersonalEmail, 1);
1);
histogram_tester.ExpectUniqueSample("InputMethod.Assistive.Coverage", histogram_tester.ExpectUniqueSample("InputMethod.Assistive.Coverage",
chromeos::AssistiveType::kPersonalEmail, AssistiveType::kPersonalEmail, 1);
1);
histogram_tester.ExpectTotalCount( histogram_tester.ExpectTotalCount(
"InputMethod.Assistive.TimeToAccept.PersonalInfo", 0); "InputMethod.Assistive.TimeToAccept.PersonalInfo", 0);
...@@ -375,8 +372,7 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, SuggestUserEmail) { ...@@ -375,8 +372,7 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, SuggestUserEmail) {
EXPECT_EQ(expected_result_text, helper.GetSurroundingText()); EXPECT_EQ(expected_result_text, helper.GetSurroundingText());
histogram_tester.ExpectUniqueSample("InputMethod.Assistive.Success", histogram_tester.ExpectUniqueSample("InputMethod.Assistive.Success",
chromeos::AssistiveType::kPersonalEmail, AssistiveType::kPersonalEmail, 1);
1);
histogram_tester.ExpectTotalCount( histogram_tester.ExpectTotalCount(
"InputMethod.Assistive.TimeToAccept.PersonalInfo", 1); "InputMethod.Assistive.TimeToAccept.PersonalInfo", 1);
...@@ -395,7 +391,7 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, ...@@ -395,7 +391,7 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest,
engine_.Enable(kEngineIdUs); engine_.Enable(kEngineIdUs);
chromeos::TextInputTestHelper helper(GetBrowserInputMethod()); TextInputTestHelper helper(GetBrowserInputMethod());
SetUpTextInput(helper); SetUpTextInput(helper);
const base::string16 prefix_text = base::UTF8ToUTF16("my email is "); const base::string16 prefix_text = base::UTF8ToUTF16("my email is ");
...@@ -416,8 +412,7 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, ...@@ -416,8 +412,7 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest,
EXPECT_EQ(expected_result_text, helper.GetSurroundingText()); EXPECT_EQ(expected_result_text, helper.GetSurroundingText());
histogram_tester.ExpectUniqueSample("InputMethod.Assistive.Success", histogram_tester.ExpectUniqueSample("InputMethod.Assistive.Success",
chromeos::AssistiveType::kPersonalEmail, AssistiveType::kPersonalEmail, 0);
0);
histogram_tester.ExpectTotalCount( histogram_tester.ExpectTotalCount(
"InputMethod.Assistive.TimeToDismiss.PersonalInfo", 1); "InputMethod.Assistive.TimeToDismiss.PersonalInfo", 1);
...@@ -438,7 +433,7 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, SuggestUserName) { ...@@ -438,7 +433,7 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, SuggestUserName) {
engine_.Enable(kEngineIdUs); engine_.Enable(kEngineIdUs);
chromeos::TextInputTestHelper helper(GetBrowserInputMethod()); TextInputTestHelper helper(GetBrowserInputMethod());
SetUpTextInput(helper); SetUpTextInput(helper);
const base::string16 prefix_text = base::UTF8ToUTF16("my name is "); const base::string16 prefix_text = base::UTF8ToUTF16("my name is ");
...@@ -448,13 +443,11 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, SuggestUserName) { ...@@ -448,13 +443,11 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, SuggestUserName) {
helper.GetTextInputClient()->InsertText(prefix_text); helper.GetTextInputClient()->InsertText(prefix_text);
helper.WaitForSurroundingTextChanged(prefix_text); helper.WaitForSurroundingTextChanged(prefix_text);
histogram_tester.ExpectUniqueSample( histogram_tester.ExpectUniqueSample(
"InputMethod.Assistive.Disabled.PersonalInfo", "InputMethod.Assistive.Disabled.PersonalInfo", DisabledReason::kNone, 1);
chromeos::DisabledReason::kNone, 1); histogram_tester.ExpectUniqueSample("InputMethod.Assistive.Match",
histogram_tester.ExpectUniqueSample( AssistiveType::kPersonalName, 1);
"InputMethod.Assistive.Match", chromeos::AssistiveType::kPersonalName, 1);
histogram_tester.ExpectUniqueSample("InputMethod.Assistive.Coverage", histogram_tester.ExpectUniqueSample("InputMethod.Assistive.Coverage",
chromeos::AssistiveType::kPersonalName, AssistiveType::kPersonalName, 1);
1);
// Keep typing // Keep typing
helper.GetTextInputClient()->InsertText(base::UTF8ToUTF16("jo")); helper.GetTextInputClient()->InsertText(base::UTF8ToUTF16("jo"));
...@@ -468,11 +461,9 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, SuggestUserName) { ...@@ -468,11 +461,9 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, SuggestUserName) {
// Make sure we do not emit multiple Coverage metrics when users keep typing. // Make sure we do not emit multiple Coverage metrics when users keep typing.
histogram_tester.ExpectUniqueSample("InputMethod.Assistive.Coverage", histogram_tester.ExpectUniqueSample("InputMethod.Assistive.Coverage",
chromeos::AssistiveType::kPersonalName, AssistiveType::kPersonalName, 1);
1);
histogram_tester.ExpectUniqueSample("InputMethod.Assistive.Success", histogram_tester.ExpectUniqueSample("InputMethod.Assistive.Success",
chromeos::AssistiveType::kPersonalName, AssistiveType::kPersonalName, 1);
1);
SetFocus(nullptr); SetFocus(nullptr);
} }
...@@ -480,14 +471,14 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, SuggestUserName) { ...@@ -480,14 +471,14 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, SuggestUserName) {
IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest,
PersonalInfoDisabledReasonkUserSettingsOff) { PersonalInfoDisabledReasonkUserSettingsOff) {
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
prefs_->SetBoolean(chromeos::prefs::kAssistPersonalInfoEnabled, false); prefs_->SetBoolean(prefs::kAssistPersonalInfoEnabled, false);
ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL));
ui_test_utils::SendToOmniboxAndSubmit(browser(), "my name is "); ui_test_utils::SendToOmniboxAndSubmit(browser(), "my name is ");
histogram_tester.ExpectUniqueSample( histogram_tester.ExpectUniqueSample(
"InputMethod.Assistive.Disabled.PersonalInfo", "InputMethod.Assistive.Disabled.PersonalInfo",
chromeos::DisabledReason::kUserSettingsOff, 1); DisabledReason::kUserSettingsOff, 1);
} }
IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest,
...@@ -499,13 +490,13 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, ...@@ -499,13 +490,13 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest,
histogram_tester.ExpectUniqueSample( histogram_tester.ExpectUniqueSample(
"InputMethod.Assistive.Disabled.PersonalInfo", "InputMethod.Assistive.Disabled.PersonalInfo",
chromeos::DisabledReason::kUrlOrAppNotAllowed, 1); DisabledReason::kUrlOrAppNotAllowed, 1);
} }
IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, SuggestEmoji) { IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, SuggestEmoji) {
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
engine_.Enable(kEngineIdUs); engine_.Enable(kEngineIdUs);
chromeos::TextInputTestHelper helper(GetBrowserInputMethod()); TextInputTestHelper helper(GetBrowserInputMethod());
SetUpTextInput(helper); SetUpTextInput(helper);
const base::string16 prefix_text = base::UTF8ToUTF16("happy "); const base::string16 prefix_text = base::UTF8ToUTF16("happy ");
const base::string16 expected_result_text = base::UTF8ToUTF16("happy 😀"); const base::string16 expected_result_text = base::UTF8ToUTF16("happy 😀");
...@@ -519,13 +510,13 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, SuggestEmoji) { ...@@ -519,13 +510,13 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, SuggestEmoji) {
EXPECT_EQ(expected_result_text, helper.GetSurroundingText()); EXPECT_EQ(expected_result_text, helper.GetSurroundingText());
histogram_tester.ExpectUniqueSample("InputMethod.Assistive.Match", histogram_tester.ExpectUniqueSample("InputMethod.Assistive.Match",
chromeos::AssistiveType::kEmoji, 1); AssistiveType::kEmoji, 1);
histogram_tester.ExpectUniqueSample("InputMethod.Assistive.Disabled.Emoji", histogram_tester.ExpectUniqueSample("InputMethod.Assistive.Disabled.Emoji",
chromeos::DisabledReason::kNone, 1); DisabledReason::kNone, 1);
histogram_tester.ExpectUniqueSample("InputMethod.Assistive.Coverage", histogram_tester.ExpectUniqueSample("InputMethod.Assistive.Coverage",
chromeos::AssistiveType::kEmoji, 1); AssistiveType::kEmoji, 1);
histogram_tester.ExpectUniqueSample("InputMethod.Assistive.Success", histogram_tester.ExpectUniqueSample("InputMethod.Assistive.Success",
chromeos::AssistiveType::kEmoji, 1); AssistiveType::kEmoji, 1);
SetFocus(nullptr); SetFocus(nullptr);
} }
...@@ -536,7 +527,7 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, ...@@ -536,7 +527,7 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest,
histogram_tester.ExpectTotalCount("InputMethod.Assistive.TimeToDismiss.Emoji", histogram_tester.ExpectTotalCount("InputMethod.Assistive.TimeToDismiss.Emoji",
0); 0);
engine_.Enable(kEngineIdUs); engine_.Enable(kEngineIdUs);
chromeos::TextInputTestHelper helper(GetBrowserInputMethod()); TextInputTestHelper helper(GetBrowserInputMethod());
SetUpTextInput(helper); SetUpTextInput(helper);
const base::string16 prefix_text = base::UTF8ToUTF16("happy "); const base::string16 prefix_text = base::UTF8ToUTF16("happy ");
const base::string16 expected_result_text = base::UTF8ToUTF16("happy a"); const base::string16 expected_result_text = base::UTF8ToUTF16("happy a");
...@@ -556,27 +547,26 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, ...@@ -556,27 +547,26 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest,
IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest,
EmojiSuggestionDisabledReasonkEnterpriseSettingsOff) { EmojiSuggestionDisabledReasonkEnterpriseSettingsOff) {
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
prefs_->SetBoolean(chromeos::prefs::kEmojiSuggestionEnterpriseAllowed, false); prefs_->SetBoolean(prefs::kEmojiSuggestionEnterpriseAllowed, false);
ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL));
ui_test_utils::SendToOmniboxAndSubmit(browser(), "happy "); ui_test_utils::SendToOmniboxAndSubmit(browser(), "happy ");
histogram_tester.ExpectUniqueSample( histogram_tester.ExpectUniqueSample("InputMethod.Assistive.Disabled.Emoji",
"InputMethod.Assistive.Disabled.Emoji", DisabledReason::kEnterpriseSettingsOff,
chromeos::DisabledReason::kEnterpriseSettingsOff, 1); 1);
} }
IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest,
EmojiSuggestionDisabledReasonkUserSettingsOff) { EmojiSuggestionDisabledReasonkUserSettingsOff) {
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
prefs_->SetBoolean(chromeos::prefs::kEmojiSuggestionEnabled, false); prefs_->SetBoolean(prefs::kEmojiSuggestionEnabled, false);
ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL));
ui_test_utils::SendToOmniboxAndSubmit(browser(), "happy "); ui_test_utils::SendToOmniboxAndSubmit(browser(), "happy ");
histogram_tester.ExpectUniqueSample( histogram_tester.ExpectUniqueSample("InputMethod.Assistive.Disabled.Emoji",
"InputMethod.Assistive.Disabled.Emoji", DisabledReason::kUserSettingsOff, 1);
chromeos::DisabledReason::kUserSettingsOff, 1);
} }
IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest,
...@@ -586,9 +576,8 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, ...@@ -586,9 +576,8 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest,
ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL));
ui_test_utils::SendToOmniboxAndSubmit(browser(), "happy "); ui_test_utils::SendToOmniboxAndSubmit(browser(), "happy ");
histogram_tester.ExpectUniqueSample( histogram_tester.ExpectUniqueSample("InputMethod.Assistive.Disabled.Emoji",
"InputMethod.Assistive.Disabled.Emoji", DisabledReason::kUrlOrAppNotAllowed, 1);
chromeos::DisabledReason::kUrlOrAppNotAllowed, 1);
} }
IN_PROC_BROWSER_TEST_F( IN_PROC_BROWSER_TEST_F(
...@@ -627,7 +616,7 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, ...@@ -627,7 +616,7 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest,
base::Value pinyin1(base::Value::Type::DICTIONARY); base::Value pinyin1(base::Value::Type::DICTIONARY);
pinyin1.SetBoolKey("foo", true); pinyin1.SetBoolKey("foo", true);
settings.SetPath("pinyin", std::move(pinyin1)); settings.SetPath("pinyin", std::move(pinyin1));
prefs_->Set(prefs::kLanguageInputMethodSpecificSettings, settings); prefs_->Set(::prefs::kLanguageInputMethodSpecificSettings, settings);
EXPECT_EQ(observer_->GetChangedEngineId(), "pinyin"); EXPECT_EQ(observer_->GetChangedEngineId(), "pinyin");
observer_->ClearChangedEngineId(); observer_->ClearChangedEngineId();
...@@ -635,7 +624,7 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, ...@@ -635,7 +624,7 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest,
base::Value pinyin2(base::Value::Type::DICTIONARY); base::Value pinyin2(base::Value::Type::DICTIONARY);
pinyin2.SetBoolKey("foo", false); pinyin2.SetBoolKey("foo", false);
settings.SetPath("pinyin", std::move(pinyin2)); settings.SetPath("pinyin", std::move(pinyin2));
prefs_->Set(prefs::kLanguageInputMethodSpecificSettings, settings); prefs_->Set(::prefs::kLanguageInputMethodSpecificSettings, settings);
EXPECT_EQ(observer_->GetChangedEngineId(), "pinyin"); EXPECT_EQ(observer_->GetChangedEngineId(), "pinyin");
} }
...@@ -686,7 +675,7 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, ...@@ -686,7 +675,7 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest,
IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest,
ShowsAndHidesAutocorrectUndoWindow) { ShowsAndHidesAutocorrectUndoWindow) {
engine_.Enable(kEngineIdUs); engine_.Enable(kEngineIdUs);
chromeos::TextInputTestHelper helper(GetBrowserInputMethod()); TextInputTestHelper helper(GetBrowserInputMethod());
SetUpTextInput(helper); SetUpTextInput(helper);
const base::string16 prefix_text = base::UTF8ToUTF16("corrected "); const base::string16 prefix_text = base::UTF8ToUTF16("corrected ");
helper.GetTextInputClient()->InsertText(prefix_text); helper.GetTextInputClient()->InsertText(prefix_text);
...@@ -695,7 +684,7 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, ...@@ -695,7 +684,7 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest,
engine_.OnAutocorrect("typed", "corrected", 0); engine_.OnAutocorrect("typed", "corrected", 0);
auto* controller = auto* controller =
((chromeos::input_method:: ((input_method::
AssistiveWindowController*)(ui::IMEBridge::Get() AssistiveWindowController*)(ui::IMEBridge::Get()
->GetAssistiveWindowHandler())); ->GetAssistiveWindowHandler()));
...@@ -713,7 +702,7 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, ...@@ -713,7 +702,7 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest,
IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, RevertsAutocorrect) { IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, RevertsAutocorrect) {
engine_.Enable(kEngineIdUs); engine_.Enable(kEngineIdUs);
chromeos::TextInputTestHelper helper(GetBrowserInputMethod()); TextInputTestHelper helper(GetBrowserInputMethod());
SetUpTextInput(helper); SetUpTextInput(helper);
const base::string16 corrected_text = const base::string16 corrected_text =
base::UTF8ToUTF16("hello corrected world"); base::UTF8ToUTF16("hello corrected world");
...@@ -753,7 +742,7 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, ...@@ -753,7 +742,7 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest,
RevertsAutocorrectWithKeyboard) { RevertsAutocorrectWithKeyboard) {
engine_.Enable(kEngineIdUs); engine_.Enable(kEngineIdUs);
chromeos::TextInputTestHelper helper(GetBrowserInputMethod()); TextInputTestHelper helper(GetBrowserInputMethod());
SetUpTextInput(helper); SetUpTextInput(helper);
const base::string16 corrected_text = base::UTF8ToUTF16("corrected"); const base::string16 corrected_text = base::UTF8ToUTF16("corrected");
const base::string16 typed_text = base::UTF8ToUTF16("typed"); const base::string16 typed_text = base::UTF8ToUTF16("typed");
...@@ -791,9 +780,9 @@ class NativeInputMethodEngineAssistiveOff : public InProcessBrowserTest { ...@@ -791,9 +780,9 @@ class NativeInputMethodEngineAssistiveOff : public InProcessBrowserTest {
public: public:
NativeInputMethodEngineAssistiveOff() { NativeInputMethodEngineAssistiveOff() {
feature_list_.InitWithFeatures( feature_list_.InitWithFeatures(
/*enabled_features=*/{chromeos::features::kAssistPersonalInfoName}, /*enabled_features=*/{features::kAssistPersonalInfoName},
/*disabled_features=*/{chromeos::features::kAssistPersonalInfo, /*disabled_features=*/{features::kAssistPersonalInfo,
chromeos::features::kEmojiSuggestAddition}); features::kEmojiSuggestAddition});
} }
~NativeInputMethodEngineAssistiveOff() override = default; ~NativeInputMethodEngineAssistiveOff() override = default;
...@@ -816,7 +805,7 @@ class NativeInputMethodEngineAssistiveOff : public InProcessBrowserTest { ...@@ -816,7 +805,7 @@ class NativeInputMethodEngineAssistiveOff : public InProcessBrowserTest {
void TearDown() override { engine_.Reset(); } void TearDown() override { engine_.Reset(); }
chromeos::NativeInputMethodEngine engine_; NativeInputMethodEngine engine_;
Profile* profile_; Profile* profile_;
TestObserver* observer_; TestObserver* observer_;
...@@ -833,7 +822,7 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineAssistiveOff, ...@@ -833,7 +822,7 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineAssistiveOff,
histogram_tester.ExpectUniqueSample( histogram_tester.ExpectUniqueSample(
"InputMethod.Assistive.Disabled.PersonalInfo", "InputMethod.Assistive.Disabled.PersonalInfo",
chromeos::DisabledReason::kFeatureFlagOff, 1); DisabledReason::kFeatureFlagOff, 1);
} }
IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineAssistiveOff, IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineAssistiveOff,
...@@ -847,6 +836,6 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineAssistiveOff, ...@@ -847,6 +836,6 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineAssistiveOff,
ui_test_utils::SendToOmniboxAndSubmit(browser(), "happy "); ui_test_utils::SendToOmniboxAndSubmit(browser(), "happy ");
histogram_tester.ExpectUniqueSample("InputMethod.Assistive.Disabled.Emoji", histogram_tester.ExpectUniqueSample("InputMethod.Assistive.Disabled.Emoji",
chromeos::DisabledReason::kFeatureFlagOff, DisabledReason::kFeatureFlagOff, 1);
1); } // namespace
} } // namespace chromeos
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment