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 "chrome/browser/renderer_context_menu/spellchecker_submenu_observer.h" | 5 #include "chrome/browser/renderer_context_menu/spellchecker_submenu_observer.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" | 10 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 scoped_ptr<TestingProfile> profile_; | 106 scoped_ptr<TestingProfile> profile_; |
107 | 107 |
108 DISALLOW_COPY_AND_ASSIGN(MockRenderViewContextMenu); | 108 DISALLOW_COPY_AND_ASSIGN(MockRenderViewContextMenu); |
109 }; | 109 }; |
110 | 110 |
111 // A test class used in this file. This test should be a browser test because it | 111 // A test class used in this file. This test should be a browser test because it |
112 // accesses resources. | 112 // accesses resources. |
113 class SpellCheckerSubMenuObserverTest : public InProcessBrowserTest { | 113 class SpellCheckerSubMenuObserverTest : public InProcessBrowserTest { |
114 public: | 114 public: |
115 SpellCheckerSubMenuObserverTest() {} | 115 SpellCheckerSubMenuObserverTest() {} |
116 virtual ~SpellCheckerSubMenuObserverTest() {} | 116 ~SpellCheckerSubMenuObserverTest() override {} |
117 | 117 |
118 private: | 118 private: |
119 DISALLOW_COPY_AND_ASSIGN(SpellCheckerSubMenuObserverTest); | 119 DISALLOW_COPY_AND_ASSIGN(SpellCheckerSubMenuObserverTest); |
120 }; | 120 }; |
121 | 121 |
122 } // namespace | 122 } // namespace |
123 | 123 |
124 // Tests that selecting the "Check Spelling While Typing" item toggles the value | 124 // Tests that selecting the "Check Spelling While Typing" item toggles the value |
125 // of the "browser.enable_spellchecking" profile. | 125 // of the "browser.enable_spellchecking" profile. |
126 IN_PROC_BROWSER_TEST_F(SpellCheckerSubMenuObserverTest, ToggleSpelling) { | 126 IN_PROC_BROWSER_TEST_F(SpellCheckerSubMenuObserverTest, ToggleSpelling) { |
(...skipping 14 matching lines...) Expand all Loading... |
141 EXPECT_TRUE(menu->IsCommandIdChecked(IDC_CHECK_SPELLING_WHILE_TYPING)); | 141 EXPECT_TRUE(menu->IsCommandIdChecked(IDC_CHECK_SPELLING_WHILE_TYPING)); |
142 | 142 |
143 // Select this item and verify that the "Check Spelling While Typing" item is | 143 // Select this item and verify that the "Check Spelling While Typing" item is |
144 // not checked. Also, verify that the value of "browser.enable_spellchecking" | 144 // not checked. Also, verify that the value of "browser.enable_spellchecking" |
145 // is now false. | 145 // is now false. |
146 menu->ExecuteCommand(IDC_CHECK_SPELLING_WHILE_TYPING, 0); | 146 menu->ExecuteCommand(IDC_CHECK_SPELLING_WHILE_TYPING, 0); |
147 EXPECT_FALSE( | 147 EXPECT_FALSE( |
148 menu->GetPrefs()->GetBoolean(prefs::kEnableContinuousSpellcheck)); | 148 menu->GetPrefs()->GetBoolean(prefs::kEnableContinuousSpellcheck)); |
149 EXPECT_FALSE(menu->IsCommandIdChecked(IDC_CHECK_SPELLING_WHILE_TYPING)); | 149 EXPECT_FALSE(menu->IsCommandIdChecked(IDC_CHECK_SPELLING_WHILE_TYPING)); |
150 } | 150 } |
OLD | NEW |