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

Side by Side Diff: ash/ime/input_method_menu_manager_unittest.cc

Issue 680153002: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix formatting Created 6 years, 1 month 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 | « ash/ime/infolist_window.cc ('k') | ash/ime/mode_indicator_view.h » ('j') | 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 "ash/ime/input_method_menu_manager.h" 5 #include "ash/ime/input_method_menu_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 namespace ash { 11 namespace ash {
12 namespace ime { 12 namespace ime {
13 13
14 TEST(InputMethodMenuManagerTest, TestGetSingleton) { 14 TEST(InputMethodMenuManagerTest, TestGetSingleton) {
15 EXPECT_TRUE(InputMethodMenuManager::GetInstance()); 15 EXPECT_TRUE(InputMethodMenuManager::GetInstance());
16 } 16 }
17 17
18 class MockObserver : public InputMethodMenuManager::Observer { 18 class MockObserver : public InputMethodMenuManager::Observer {
19 public: 19 public:
20 MockObserver() : input_method_menu_item_changed_count_(0) {} 20 MockObserver() : input_method_menu_item_changed_count_(0) {}
21 virtual ~MockObserver() {} 21 ~MockObserver() override {}
22 22
23 // Called when the list of menu items is changed. 23 // Called when the list of menu items is changed.
24 virtual void InputMethodMenuItemChanged( 24 void InputMethodMenuItemChanged(InputMethodMenuManager* manager) override {
25 InputMethodMenuManager* manager) override {
26 input_method_menu_item_changed_count_++; 25 input_method_menu_item_changed_count_++;
27 } 26 }
28 int input_method_menu_item_changed_count_; 27 int input_method_menu_item_changed_count_;
29 }; 28 };
30 29
31 class InputMethodMenuManagerStatefulTest : public testing::Test{ 30 class InputMethodMenuManagerStatefulTest : public testing::Test{
32 public: 31 public:
33 InputMethodMenuManagerStatefulTest() 32 InputMethodMenuManagerStatefulTest()
34 : observer_(new MockObserver()) {} 33 : observer_(new MockObserver()) {}
35 virtual ~InputMethodMenuManagerStatefulTest() {} 34 ~InputMethodMenuManagerStatefulTest() override {}
36 virtual void SetUp() override { 35 void SetUp() override {
37 menu_manager_ = InputMethodMenuManager::GetInstance(); 36 menu_manager_ = InputMethodMenuManager::GetInstance();
38 menu_manager_->AddObserver(observer_.get()); 37 menu_manager_->AddObserver(observer_.get());
39 } 38 }
40 39
41 virtual void TearDown() override { 40 void TearDown() override { menu_manager_->RemoveObserver(observer_.get()); }
42 menu_manager_->RemoveObserver(observer_.get());
43 }
44 41
45 InputMethodMenuManager* menu_manager_; 42 InputMethodMenuManager* menu_manager_;
46 scoped_ptr<MockObserver> observer_; 43 scoped_ptr<MockObserver> observer_;
47 }; 44 };
48 45
49 TEST_F(InputMethodMenuManagerStatefulTest, AddAndObserve) { 46 TEST_F(InputMethodMenuManagerStatefulTest, AddAndObserve) {
50 EXPECT_EQ(observer_->input_method_menu_item_changed_count_, 0); 47 EXPECT_EQ(observer_->input_method_menu_item_changed_count_, 0);
51 menu_manager_->SetCurrentInputMethodMenuItemList(InputMethodMenuItemList()); 48 menu_manager_->SetCurrentInputMethodMenuItemList(InputMethodMenuItemList());
52 EXPECT_EQ(observer_->input_method_menu_item_changed_count_, 1); 49 EXPECT_EQ(observer_->input_method_menu_item_changed_count_, 1);
53 } 50 }
(...skipping 13 matching lines...) Expand all
67 "key=key2, label=label2, " 64 "key=key2, label=label2, "
68 "is_selection_item=0, is_selection_item_checked=0"); 65 "is_selection_item=0, is_selection_item_checked=0");
69 66
70 EXPECT_TRUE(menu_manager_->HasInputMethodMenuItemForKey("key1")); 67 EXPECT_TRUE(menu_manager_->HasInputMethodMenuItemForKey("key1"));
71 EXPECT_TRUE(menu_manager_->HasInputMethodMenuItemForKey("key2")); 68 EXPECT_TRUE(menu_manager_->HasInputMethodMenuItemForKey("key2"));
72 EXPECT_FALSE(menu_manager_->HasInputMethodMenuItemForKey("key-not-exist")); 69 EXPECT_FALSE(menu_manager_->HasInputMethodMenuItemForKey("key-not-exist"));
73 } 70 }
74 71
75 } // namespace ime 72 } // namespace ime
76 } // namespace ash 73 } // namespace ash
OLDNEW
« no previous file with comments | « ash/ime/infolist_window.cc ('k') | ash/ime/mode_indicator_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698