| OLD | NEW |
| 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 #include "base/macros.h" | 5 #include "base/macros.h" |
| 6 #include "base/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
| 7 #include "base/test/scoped_feature_list.h" | |
| 8 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 9 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/ui/browser_window.h" | 9 #include "chrome/browser/ui/browser_window.h" |
| 11 #include "chrome/browser/ui/chrome_pages.h" | 10 #include "chrome/browser/ui/chrome_pages.h" |
| 12 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 11 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 13 #include "chrome/common/chrome_features.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 "content/public/test/browser_test_utils.h" | 15 #include "content/public/test/browser_test_utils.h" |
| 18 | 16 |
| 19 namespace { | 17 namespace { |
| 20 | 18 |
| 21 // This class tests the language dictionary settings. | 19 // This class tests the language dictionary settings. |
| 22 // This test is part of the interactive_ui_tests instead of browser_tests | 20 // This test is part of the interactive_ui_tests instead of browser_tests |
| 23 // because it is necessary to emulate pushing the tab key. | 21 // because it is necessary to emulate pushing the tab key. |
| 24 class LanguageDictionaryWebUITest : public InProcessBrowserTest { | 22 class LanguageDictionaryWebUITest : public InProcessBrowserTest { |
| 25 public: | 23 public: |
| 26 LanguageDictionaryWebUITest() {} | 24 LanguageDictionaryWebUITest() {} |
| 27 | 25 |
| 28 // Navigate to the editDictionary page. | 26 // Navigate to the editDictionary page. |
| 29 void SetUpOnMainThread() override { | 27 void SetUpOnMainThread() override { |
| 30 disable_md_settings_.InitAndDisableFeature( | |
| 31 features::kMaterialDesignSettings); | |
| 32 const GURL url = chrome::GetSettingsUrl("editDictionary"); | 28 const GURL url = chrome::GetSettingsUrl("editDictionary"); |
| 33 ui_test_utils::NavigateToURL(browser(), url); | 29 ui_test_utils::NavigateToURL(browser(), url); |
| 34 } | 30 } |
| 35 | 31 |
| 36 protected: | 32 protected: |
| 37 const std::string kDictionaryListSelector = | 33 const std::string kDictionaryListSelector = |
| 38 "#language-dictionary-overlay-word-list"; | 34 "#language-dictionary-overlay-word-list"; |
| 39 | 35 |
| 40 content::RenderFrameHost* GetActiveFrame() { | 36 content::RenderFrameHost* GetActiveFrame() { |
| 41 return GetActiveWebContents()->GetFocusedFrame(); | 37 return GetActiveWebContents()->GetFocusedFrame(); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 list_selector.c_str(), | 170 list_selector.c_str(), |
| 175 index); | 171 index); |
| 176 | 172 |
| 177 EXPECT_TRUE(content::ExecuteScript( | 173 EXPECT_TRUE(content::ExecuteScript( |
| 178 GetActiveFrame(), | 174 GetActiveFrame(), |
| 179 script)); | 175 script)); |
| 180 } | 176 } |
| 181 | 177 |
| 182 private: | 178 private: |
| 183 std::unique_ptr<content::DOMMessageQueue> dom_message_queue_; | 179 std::unique_ptr<content::DOMMessageQueue> dom_message_queue_; |
| 184 base::test::ScopedFeatureList disable_md_settings_; | |
| 185 | 180 |
| 186 DISALLOW_COPY_AND_ASSIGN(LanguageDictionaryWebUITest); | 181 DISALLOW_COPY_AND_ASSIGN(LanguageDictionaryWebUITest); |
| 187 }; | 182 }; |
| 188 | 183 |
| 189 } // namespace | 184 } // namespace |
| 190 | 185 |
| 191 // Test InlineEditableItemList keyboard focus behavior in editDictionary | 186 // Test InlineEditableItemList keyboard focus behavior in editDictionary |
| 192 // overlay. | 187 // overlay. |
| 193 // editDictionary overlay doesn't exist on OSX so disable it there. | 188 // editDictionary overlay doesn't exist on OSX so disable it there. |
| 194 #if !defined(OS_MACOSX) | 189 #if !defined(OS_MACOSX) |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 EXPECT_TRUE(ListItemSelected(list_selector, placeholder_index - 1)); | 241 EXPECT_TRUE(ListItemSelected(list_selector, placeholder_index - 1)); |
| 247 | 242 |
| 248 // Press shift+tab to go back to the list. | 243 // Press shift+tab to go back to the list. |
| 249 PressKey(ui::VKEY_TAB, true); | 244 PressKey(ui::VKEY_TAB, true); |
| 250 | 245 |
| 251 // Verify that the item above the placeholder is selected and has focus. | 246 // Verify that the item above the placeholder is selected and has focus. |
| 252 EXPECT_TRUE(ListItemSelectedAndFocused(list_selector, | 247 EXPECT_TRUE(ListItemSelectedAndFocused(list_selector, |
| 253 placeholder_index - 1)); | 248 placeholder_index - 1)); |
| 254 } | 249 } |
| 255 #endif // !defined(OS_MACOSX) | 250 #endif // !defined(OS_MACOSX) |
| OLD | NEW |