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