OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "base/macros.h" | 5 #include "base/macros.h" |
6 #include "base/test/scoped_feature_list.h" | |
7 #include "build/build_config.h" | 6 #include "build/build_config.h" |
8 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
9 #include "chrome/browser/ui/browser_window.h" | 8 #include "chrome/browser/ui/browser_window.h" |
10 #include "chrome/browser/ui/chrome_pages.h" | 9 #include "chrome/browser/ui/chrome_pages.h" |
11 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
12 #include "chrome/common/chrome_features.h" | |
13 #include "chrome/common/pref_names.h" | 11 #include "chrome/common/pref_names.h" |
14 #include "chrome/common/url_constants.h" | 12 #include "chrome/common/url_constants.h" |
15 #include "chrome/test/base/in_process_browser_test.h" | 13 #include "chrome/test/base/in_process_browser_test.h" |
16 #include "chrome/test/base/interactive_test_utils.h" | 14 #include "chrome/test/base/interactive_test_utils.h" |
17 #include "chrome/test/base/ui_test_utils.h" | 15 #include "chrome/test/base/ui_test_utils.h" |
18 #include "components/prefs/pref_service.h" | 16 #include "components/prefs/pref_service.h" |
19 #include "content/public/browser/render_frame_host.h" | 17 #include "content/public/browser/render_frame_host.h" |
20 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
21 #include "content/public/test/browser_test_utils.h" | 19 #include "content/public/test/browser_test_utils.h" |
22 | 20 |
23 namespace language_options_ui_test { | 21 namespace language_options_ui_test { |
24 | 22 |
25 namespace { | 23 namespace { |
26 | 24 |
27 // This class will test the language options settings. | 25 // This class will test the language options settings. |
28 // This test is part of the interactive_ui_tests isntead of browser_tests | 26 // This test is part of the interactive_ui_tests isntead of browser_tests |
29 // because it is necessary to emulate pushing a button in order to properly | 27 // because it is necessary to emulate pushing a button in order to properly |
30 // test accessibility. | 28 // test accessibility. |
31 class LanguageOptionsWebUITest : public InProcessBrowserTest { | 29 class LanguageOptionsWebUITest : public InProcessBrowserTest { |
32 public: | 30 public: |
33 LanguageOptionsWebUITest() {} | 31 LanguageOptionsWebUITest() {} |
34 | 32 |
35 void SetUpInProcessBrowserTestFixture() override { | |
36 disable_md_settings_.InitAndDisableFeature( | |
37 features::kMaterialDesignSettings); | |
38 } | |
39 | |
40 // This method will navigate to the language settings page and show | 33 // This method will navigate to the language settings page and show |
41 // a subset of languages from the list of available languages. | 34 // a subset of languages from the list of available languages. |
42 void SetUpOnMainThread() override { | 35 void SetUpOnMainThread() override { |
43 #if defined(OS_CHROMEOS) | 36 #if defined(OS_CHROMEOS) |
44 auto* setting_name = prefs::kLanguagePreferredLanguages; | 37 auto* setting_name = prefs::kLanguagePreferredLanguages; |
45 #else | 38 #else |
46 auto* setting_name = prefs::kAcceptLanguages; | 39 auto* setting_name = prefs::kAcceptLanguages; |
47 #endif | 40 #endif |
48 | 41 |
49 const GURL url = chrome::GetSettingsUrl(chrome::kLanguageOptionsSubPage); | 42 const GURL url = chrome::GetSettingsUrl(chrome::kLanguageOptionsSubPage); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 key_code, | 77 key_code, |
85 false, | 78 false, |
86 false, | 79 false, |
87 false, | 80 false, |
88 false, | 81 false, |
89 content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, | 82 content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, |
90 content::Source<content::RenderViewHost>(GetRenderViewHost())); | 83 content::Source<content::RenderViewHost>(GetRenderViewHost())); |
91 } | 84 } |
92 | 85 |
93 private: | 86 private: |
94 base::test::ScopedFeatureList disable_md_settings_; | |
95 | |
96 DISALLOW_COPY_AND_ASSIGN(LanguageOptionsWebUITest); | 87 DISALLOW_COPY_AND_ASSIGN(LanguageOptionsWebUITest); |
97 }; | 88 }; |
98 | 89 |
99 } // namespace | 90 } // namespace |
100 | 91 |
101 // This test will verify that the appropriate languages are available. | 92 // This test will verify that the appropriate languages are available. |
102 // This test will also fail if the language page is not loaded because a random | 93 // This test will also fail if the language page is not loaded because a random |
103 // page will not have the language list. | 94 // page will not have the language list. |
104 // Test assumes that the default active element is the list of languages. | 95 // Test assumes that the default active element is the list of languages. |
105 IN_PROC_BROWSER_TEST_F(LanguageOptionsWebUITest, TestAvailableLanguages) { | 96 IN_PROC_BROWSER_TEST_F(LanguageOptionsWebUITest, TestAvailableLanguages) { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 // Make sure that the element is now the button that is next in the tab order. | 148 // Make sure that the element is now the button that is next in the tab order. |
158 // Checking that the list is no longer selected is not sufficient to validate | 149 // Checking that the list is no longer selected is not sufficient to validate |
159 // this use case because this test should fail if an item inside the list is | 150 // this use case because this test should fail if an item inside the list is |
160 // selected. | 151 // selected. |
161 std::string new_id = GetActiveElementId(); | 152 std::string new_id = GetActiveElementId(); |
162 EXPECT_EQ("language-options-add-button", new_id); | 153 EXPECT_EQ("language-options-add-button", new_id); |
163 } | 154 } |
164 | 155 |
165 } // namespace language_options_ui_test | 156 } // namespace language_options_ui_test |
166 | 157 |
OLD | NEW |