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

Side by Side Diff: chrome/browser/ui/webui/signin/login_ui_service_unittest.cc

Issue 671653002: Standardize usage of virtual/override/final in chrome/browser/ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 (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/ui/webui/signin/login_ui_service.h" 5 #include "chrome/browser/ui/webui/signin/login_ui_service.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 class TestLoginUI : public LoginUIService::LoginUI { 11 class TestLoginUI : public LoginUIService::LoginUI {
12 public: 12 public:
13 TestLoginUI() { } 13 TestLoginUI() { }
14 virtual ~TestLoginUI() { } 14 ~TestLoginUI() override {}
15 virtual void FocusUI() override { } 15 void FocusUI() override {}
16 virtual void CloseUI() override { } 16 void CloseUI() override {}
17 17
18 private: 18 private:
19 DISALLOW_COPY_AND_ASSIGN(TestLoginUI); 19 DISALLOW_COPY_AND_ASSIGN(TestLoginUI);
20 }; 20 };
21 21
22 class TestObserver : public LoginUIService::Observer { 22 class TestObserver : public LoginUIService::Observer {
23 public: 23 public:
24 TestObserver() : ui_shown_count_(0), 24 TestObserver() : ui_shown_count_(0),
25 ui_closed_count_(0) { 25 ui_closed_count_(0) {
26 } 26 }
27 27
28 int ui_shown_count() const { return ui_shown_count_; } 28 int ui_shown_count() const { return ui_shown_count_; }
29 int ui_closed_count() const { return ui_closed_count_; } 29 int ui_closed_count() const { return ui_closed_count_; }
30 30
31 private: 31 private:
32 virtual void OnLoginUIShown(LoginUIService::LoginUI* ui) override { 32 void OnLoginUIShown(LoginUIService::LoginUI* ui) override {
33 ++ui_shown_count_; 33 ++ui_shown_count_;
34 } 34 }
35 35
36 virtual void OnLoginUIClosed(LoginUIService::LoginUI* ui) override { 36 void OnLoginUIClosed(LoginUIService::LoginUI* ui) override {
37 ++ui_closed_count_; 37 ++ui_closed_count_;
38 } 38 }
39 39
40 int ui_shown_count_; 40 int ui_shown_count_;
41 int ui_closed_count_; 41 int ui_closed_count_;
42 42
43 DISALLOW_COPY_AND_ASSIGN(TestObserver); 43 DISALLOW_COPY_AND_ASSIGN(TestObserver);
44 }; 44 };
45 45
46 class LoginUIServiceTest : public testing::Test { 46 class LoginUIServiceTest : public testing::Test {
(...skipping 21 matching lines...) Expand all
68 // notification should be fired. 68 // notification should be fired.
69 TestLoginUI other_ui; 69 TestLoginUI other_ui;
70 service_.LoginUIClosed(&other_ui); 70 service_.LoginUIClosed(&other_ui);
71 EXPECT_EQ(1, observer_.ui_shown_count()); 71 EXPECT_EQ(1, observer_.ui_shown_count());
72 72
73 // If the right UI is closed, notification should be fired. 73 // If the right UI is closed, notification should be fired.
74 service_.LoginUIClosed(&ui); 74 service_.LoginUIClosed(&ui);
75 EXPECT_EQ(1, observer_.ui_closed_count()); 75 EXPECT_EQ(1, observer_.ui_closed_count());
76 service_.RemoveObserver(&observer_); 76 service_.RemoveObserver(&observer_);
77 } 77 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698