Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(323)

Side by Side Diff: chrome/browser/renderer_context_menu/spelling_menu_observer_browsertest.cc

Issue 2280113002: [SpellCheck] Add separator if we add "Add to dictionary" option (Closed)
Patch Set: Only add separator if there are suggestions above it Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/renderer_context_menu/spelling_menu_observer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/spelling_menu_observer.h" 5 #include "chrome/browser/renderer_context_menu/spelling_menu_observer.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 EXPECT_EQ(-1, item.command_id); 177 EXPECT_EQ(-1, item.command_id);
178 EXPECT_FALSE(item.enabled); 178 EXPECT_FALSE(item.enabled);
179 EXPECT_FALSE(item.hidden); 179 EXPECT_FALSE(item.hidden);
180 180
181 menu()->GetMenuItem(1, &item); 181 menu()->GetMenuItem(1, &item);
182 EXPECT_EQ(IDC_SPELLCHECK_SUGGESTION_0, item.command_id); 182 EXPECT_EQ(IDC_SPELLCHECK_SUGGESTION_0, item.command_id);
183 EXPECT_TRUE(item.enabled); 183 EXPECT_TRUE(item.enabled);
184 EXPECT_FALSE(item.hidden); 184 EXPECT_FALSE(item.hidden);
185 185
186 menu()->GetMenuItem(2, &item); 186 menu()->GetMenuItem(2, &item);
187 EXPECT_EQ(-1, item.command_id);
188 EXPECT_FALSE(item.enabled);
189 EXPECT_FALSE(item.hidden);
190
191 menu()->GetMenuItem(3, &item);
187 EXPECT_EQ(IDC_SPELLCHECK_ADD_TO_DICTIONARY, item.command_id); 192 EXPECT_EQ(IDC_SPELLCHECK_ADD_TO_DICTIONARY, item.command_id);
188 EXPECT_TRUE(item.enabled); 193 EXPECT_TRUE(item.enabled);
189 EXPECT_FALSE(item.hidden); 194 EXPECT_FALSE(item.hidden);
190 195
191 menu()->GetMenuItem(3, &item); 196 menu()->GetMenuItem(4, &item);
192 EXPECT_EQ(IDC_CONTENT_CONTEXT_SPELLING_TOGGLE, item.command_id); 197 EXPECT_EQ(IDC_CONTENT_CONTEXT_SPELLING_TOGGLE, item.command_id);
193 EXPECT_TRUE(item.enabled); 198 EXPECT_TRUE(item.enabled);
194 EXPECT_TRUE(item.checked); 199 EXPECT_TRUE(item.checked);
195 EXPECT_FALSE(item.hidden); 200 EXPECT_FALSE(item.hidden);
196 201
197 menu()->GetMenuItem(4, &item); 202 menu()->GetMenuItem(5, &item);
198 EXPECT_EQ(-1, item.command_id); 203 EXPECT_EQ(-1, item.command_id);
199 EXPECT_FALSE(item.enabled); 204 EXPECT_FALSE(item.enabled);
200 EXPECT_FALSE(item.hidden); 205 EXPECT_FALSE(item.hidden);
201 } 206 }
202 207
203 // Test that "Ask Google For Suggestions" is grayed out when using an 208 // Test that "Ask Google For Suggestions" is grayed out when using an
204 // off the record profile. 209 // off the record profile.
205 // TODO(rlp): Include graying out of autocorrect in this test when autocorrect 210 // TODO(rlp): Include graying out of autocorrect in this test when autocorrect
206 // is functional. 211 // is functional.
207 IN_PROC_BROWSER_TEST_F(SpellingMenuObserverTest, 212 IN_PROC_BROWSER_TEST_F(SpellingMenuObserverTest,
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 ForceSuggestMode(); 282 ForceSuggestMode();
278 InitMenu("asdfkj", nullptr); 283 InitMenu("asdfkj", nullptr);
279 284
280 // Should have at least 2 entries. Separator, suggestion. 285 // Should have at least 2 entries. Separator, suggestion.
281 EXPECT_LT(2U, menu()->GetMenuSize()); 286 EXPECT_LT(2U, menu()->GetMenuSize());
282 menu()->GetMenuItem(0, &item); 287 menu()->GetMenuItem(0, &item);
283 EXPECT_EQ(-1, item.command_id); 288 EXPECT_EQ(-1, item.command_id);
284 menu()->GetMenuItem(1, &item); 289 menu()->GetMenuItem(1, &item);
285 EXPECT_EQ(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, item.command_id); 290 EXPECT_EQ(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, item.command_id);
286 } 291 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_context_menu/spelling_menu_observer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698