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