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

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

Issue 629603002: replace OVERRIDE and FINAL with override and final in chrome/browser/[r-z]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 6 years, 2 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
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 <vector> 7 #include <vector>
8 8
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 29 matching lines...) Expand all
40 bool checked; 40 bool checked;
41 bool hidden; 41 bool hidden;
42 base::string16 title; 42 base::string16 title;
43 }; 43 };
44 44
45 explicit MockRenderViewContextMenu(bool incognito); 45 explicit MockRenderViewContextMenu(bool incognito);
46 virtual ~MockRenderViewContextMenu(); 46 virtual ~MockRenderViewContextMenu();
47 47
48 // RenderViewContextMenuProxy implementation. 48 // RenderViewContextMenuProxy implementation.
49 virtual void AddMenuItem(int command_id, 49 virtual void AddMenuItem(int command_id,
50 const base::string16& title) OVERRIDE; 50 const base::string16& title) override;
51 virtual void AddCheckItem(int command_id, 51 virtual void AddCheckItem(int command_id,
52 const base::string16& title) OVERRIDE; 52 const base::string16& title) override;
53 virtual void AddSeparator() OVERRIDE; 53 virtual void AddSeparator() override;
54 virtual void AddSubMenu(int command_id, 54 virtual void AddSubMenu(int command_id,
55 const base::string16& label, 55 const base::string16& label,
56 ui::MenuModel* model) OVERRIDE; 56 ui::MenuModel* model) override;
57 virtual void UpdateMenuItem(int command_id, 57 virtual void UpdateMenuItem(int command_id,
58 bool enabled, 58 bool enabled,
59 bool hidden, 59 bool hidden,
60 const base::string16& title) OVERRIDE; 60 const base::string16& title) override;
61 virtual RenderViewHost* GetRenderViewHost() const OVERRIDE; 61 virtual RenderViewHost* GetRenderViewHost() const override;
62 virtual WebContents* GetWebContents() const OVERRIDE; 62 virtual WebContents* GetWebContents() const override;
63 virtual content::BrowserContext* GetBrowserContext() const OVERRIDE; 63 virtual content::BrowserContext* GetBrowserContext() const override;
64 64
65 // Attaches a RenderViewContextMenuObserver to be tested. 65 // Attaches a RenderViewContextMenuObserver to be tested.
66 void SetObserver(RenderViewContextMenuObserver* observer); 66 void SetObserver(RenderViewContextMenuObserver* observer);
67 67
68 // Returns the number of items added by the test. 68 // Returns the number of items added by the test.
69 size_t GetMenuSize() const; 69 size_t GetMenuSize() const;
70 70
71 // Returns the i-th item. 71 // Returns the i-th item.
72 bool GetMenuItem(size_t i, MockMenuItem* item) const; 72 bool GetMenuItem(size_t i, MockMenuItem* item) const;
73 73
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 PrefService* MockRenderViewContextMenu::GetPrefs() { 199 PrefService* MockRenderViewContextMenu::GetPrefs() {
200 return profile_->GetPrefs(); 200 return profile_->GetPrefs();
201 } 201 }
202 202
203 // A test class used in this file. This test should be a browser test because it 203 // A test class used in this file. This test should be a browser test because it
204 // accesses resources. 204 // accesses resources.
205 class SpellingMenuObserverTest : public InProcessBrowserTest { 205 class SpellingMenuObserverTest : public InProcessBrowserTest {
206 public: 206 public:
207 SpellingMenuObserverTest(); 207 SpellingMenuObserverTest();
208 208
209 virtual void SetUpOnMainThread() OVERRIDE { 209 virtual void SetUpOnMainThread() override {
210 Reset(false); 210 Reset(false);
211 } 211 }
212 212
213 virtual void TearDownOnMainThread() OVERRIDE { 213 virtual void TearDownOnMainThread() override {
214 observer_.reset(); 214 observer_.reset();
215 menu_.reset(); 215 menu_.reset();
216 } 216 }
217 217
218 void Reset(bool incognito) { 218 void Reset(bool incognito) {
219 observer_.reset(); 219 observer_.reset();
220 menu_.reset(new MockRenderViewContextMenu(incognito)); 220 menu_.reset(new MockRenderViewContextMenu(incognito));
221 observer_.reset(new SpellingMenuObserver(menu_.get())); 221 observer_.reset(new SpellingMenuObserver(menu_.get()));
222 menu_->SetObserver(observer_.get()); 222 menu_->SetObserver(observer_.get());
223 } 223 }
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 ForceSuggestMode(); 472 ForceSuggestMode();
473 InitMenu("asdfkj", NULL); 473 InitMenu("asdfkj", NULL);
474 474
475 // Should have at least 2 entries. Separator, suggestion. 475 // Should have at least 2 entries. Separator, suggestion.
476 EXPECT_LT(2U, menu()->GetMenuSize()); 476 EXPECT_LT(2U, menu()->GetMenuSize());
477 menu()->GetMenuItem(0, &item); 477 menu()->GetMenuItem(0, &item);
478 EXPECT_EQ(-1, item.command_id); 478 EXPECT_EQ(-1, item.command_id);
479 menu()->GetMenuItem(1, &item); 479 menu()->GetMenuItem(1, &item);
480 EXPECT_EQ(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, item.command_id); 480 EXPECT_EQ(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, item.command_id);
481 } 481 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698