| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/tab_contents/spelling_menu_observer.h" | 5 #include "chrome/browser/tab_contents/spelling_menu_observer.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| 11 #include "chrome/browser/prefs/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.h" |
| 12 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 12 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
| 13 #include "chrome/browser/tab_contents/render_view_context_menu_observer.h" | 13 #include "chrome/browser/tab_contents/render_view_context_menu_observer.h" |
| 14 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
| 15 #include "chrome/test/base/in_process_browser_test.h" | 15 #include "chrome/test/base/in_process_browser_test.h" |
| 16 #include "chrome/test/base/testing_profile.h" | 16 #include "chrome/test/base/testing_profile.h" |
| 17 | 17 |
| 18 using content::RenderViewHost; |
| 19 |
| 18 namespace { | 20 namespace { |
| 19 | 21 |
| 20 // A mock context menu used in this test. This class overrides virtual methods | 22 // A mock context menu used in this test. This class overrides virtual methods |
| 21 // derived from the RenderViewContextMenuProxy class to monitor calls from the | 23 // derived from the RenderViewContextMenuProxy class to monitor calls from the |
| 22 // SpellingMenuObserver class. | 24 // SpellingMenuObserver class. |
| 23 class MockRenderViewContextMenu : public RenderViewContextMenuProxy { | 25 class MockRenderViewContextMenu : public RenderViewContextMenuProxy { |
| 24 public: | 26 public: |
| 25 // A menu item used in this test. This test uses a vector of this struct to | 27 // A menu item used in this test. This test uses a vector of this struct to |
| 26 // hold menu items added by this test. | 28 // hold menu items added by this test. |
| 27 struct MockMenuItem { | 29 struct MockMenuItem { |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 | 276 |
| 275 // To avoid duplicates, this test reads only the "Ask Google for suggestions" | 277 // To avoid duplicates, this test reads only the "Ask Google for suggestions" |
| 276 // item and verifies it is enabled and checked. | 278 // item and verifies it is enabled and checked. |
| 277 MockRenderViewContextMenu::MockMenuItem item; | 279 MockRenderViewContextMenu::MockMenuItem item; |
| 278 menu->GetMenuItem(2, &item); | 280 menu->GetMenuItem(2, &item); |
| 279 EXPECT_EQ(IDC_CONTENT_CONTEXT_SPELLING_TOGGLE, item.command_id); | 281 EXPECT_EQ(IDC_CONTENT_CONTEXT_SPELLING_TOGGLE, item.command_id); |
| 280 EXPECT_TRUE(item.enabled); | 282 EXPECT_TRUE(item.enabled); |
| 281 EXPECT_TRUE(item.checked); | 283 EXPECT_TRUE(item.checked); |
| 282 EXPECT_FALSE(item.hidden); | 284 EXPECT_FALSE(item.hidden); |
| 283 } | 285 } |
| OLD | NEW |