chrome/browser/tab_contents/spelling_menu_observer_browsertest.cc
// Tests that right-clicking a misspelled word when we enable spelling-service
// integration to verify an item "Ask Google for suggestions" is checked. (This
// test does not actually send JSON-RPC requests to the service because it makes
// this test flaky.)
Tests that right-clicking a misspelled word when we enable spelling-service
integration to verify an item "Ask Google for suggestions" is checked. (This
test does not actually send JSON-RPC requests to the service because it makes
this test flaky.)
Tests that right - clicking a misspelled word when we enable spelling - service integration to verify an item " Ask Google for suggestions " is checked . ( This test does not actually send JSON - RPC requests to the service because it makes this test flaky . )
IN_PROC_BROWSER_TEST_F(SpellingMenuObserverTest, EnableSpellingService) {
  scoped_ptr<MockRenderViewContextMenu> menu(new MockRenderViewContextMenu);
  scoped_ptr<SpellingMenuObserver> observer(
      new SpellingMenuObserver(menu.get()));
  menu->SetObserver(observer.get());
  menu->GetPrefs()->SetBoolean(prefs::kSpellCheckUseSpellingService, true);
  menu->GetPrefs()->SetString(prefs::kSpellCheckDictionary, "");
  content::ContextMenuParams params;
  params.is_editable = true;
  params.misspelled_word = ASCIIToUTF16("wiimode");
  observer->InitMenu(params);
  EXPECT_EQ(static_cast<size_t>(4), menu->GetMenuSize());
  MockRenderViewContextMenu::MockMenuItem item;
  menu->GetMenuItem(2, &item);
  EXPECT_EQ(IDC_CONTENT_CONTEXT_SPELLING_TOGGLE, item.command_id);
  EXPECT_TRUE(item.enabled);
  EXPECT_TRUE(item.checked);
  EXPECT_FALSE(item.hidden);
}
IN_PROC_BROWSER_TEST_F ( SpellingMenuObserverTest , EnableSpellingService ) { scoped_ptr < MockRenderViewContextMenu > menu ( new MockRenderViewContextMenu ) ; scoped_ptr < SpellingMenuObserver > observer ( new SpellingMenuObserver ( menu . get ( ) ) ) ; menu -> SetObserver ( observer . get ( ) ) ; menu -> GetPrefs ( ) -> SetBoolean ( prefs :: kSpellCheckUseSpellingService , true ) ; menu -> GetPrefs ( ) -> SetString ( prefs :: kSpellCheckDictionary , " " ) ; content :: ContextMenuParams params ; params . is_editable = true ; params . misspelled_word = ASCIIToUTF16 ( " " ) ; observer -> InitMenu ( params ) ; EXPECT_EQ ( static_cast < size_t > ( 4 ) , menu -> GetMenuSize ( ) ) ; MockRenderViewContextMenu :: MockMenuItem item ; menu -> GetMenuItem ( 2 , & item ) ; EXPECT_EQ ( IDC_CONTENT_CONTEXT_SPELLING_TOGGLE , item . command_id ) ; EXPECT_TRUE ( item . enabled ) ; EXPECT_TRUE ( item . checked ) ; EXPECT_FALSE ( item . hidden ) ; }
Tests that right-clicking a misspelled word when we enable spelling-service
integration to verify an item "Ask Google for suggestions" is checked.
Tests that right - clicking a misspelled word when we enable spelling - service integration to verify an item " Ask Google for suggestions " is checked .
// To avoid duplicates, this test reads only the "Ask Google for suggestions" // item and verifies it is enabled and checked.