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

Side by Side Diff: components/password_manager/content/renderer/credential_manager_client_browsertest.cc

Issue 616283002: Revert "Replace OVERRIDE with its C++11 counterpart in components/password_manager/" (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 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 "components/password_manager/content/common/credential_manager_messages .h" 5 #include "components/password_manager/content/common/credential_manager_messages .h"
6 #include "components/password_manager/content/renderer/credential_manager_client .h" 6 #include "components/password_manager/content/renderer/credential_manager_client .h"
7 #include "content/public/test/render_view_test.h" 7 #include "content/public/test/render_view_test.h"
8 #include "ipc/ipc_test_sink.h" 8 #include "ipc/ipc_test_sink.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "third_party/WebKit/public/platform/WebCredential.h" 10 #include "third_party/WebKit/public/platform/WebCredential.h"
11 #include "third_party/WebKit/public/platform/WebCredentialManagerClient.h" 11 #include "third_party/WebKit/public/platform/WebCredentialManagerClient.h"
12 #include "third_party/WebKit/public/platform/WebCredentialManagerError.h" 12 #include "third_party/WebKit/public/platform/WebCredentialManagerError.h"
13 13
14 namespace password_manager { 14 namespace password_manager {
15 15
16 namespace { 16 namespace {
17 17
18 class CredentialManagerClientTest : public content::RenderViewTest { 18 class CredentialManagerClientTest : public content::RenderViewTest {
19 public: 19 public:
20 CredentialManagerClientTest() 20 CredentialManagerClientTest()
21 : callback_errored_(false), callback_succeeded_(false) {} 21 : callback_errored_(false), callback_succeeded_(false) {}
22 virtual ~CredentialManagerClientTest() {} 22 virtual ~CredentialManagerClientTest() {}
23 23
24 virtual void SetUp() override { 24 virtual void SetUp() OVERRIDE {
25 content::RenderViewTest::SetUp(); 25 content::RenderViewTest::SetUp();
26 credential_.reset(new blink::WebCredential("", "", GURL())); 26 credential_.reset(new blink::WebCredential("", "", GURL()));
27 client_.reset(new CredentialManagerClient(view_)); 27 client_.reset(new CredentialManagerClient(view_));
28 } 28 }
29 29
30 virtual void TearDown() override { 30 virtual void TearDown() OVERRIDE {
31 credential_.reset(); 31 credential_.reset();
32 content::RenderViewTest::TearDown(); 32 content::RenderViewTest::TearDown();
33 } 33 }
34 34
35 IPC::TestSink& sink() { return render_thread_->sink(); } 35 IPC::TestSink& sink() { return render_thread_->sink(); }
36 36
37 blink::WebCredential* credential() { return credential_.get(); } 37 blink::WebCredential* credential() { return credential_.get(); }
38 38
39 // The browser's response to any of the messages the client sends must contain 39 // The browser's response to any of the messages the client sends must contain
40 // a request ID so that the client knows which request is being serviced. This 40 // a request ID so that the client knows which request is being serviced. This
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 }; 105 };
106 106
107 class TestNotificationCallbacks 107 class TestNotificationCallbacks
108 : public blink::WebCredentialManagerClient::NotificationCallbacks { 108 : public blink::WebCredentialManagerClient::NotificationCallbacks {
109 public: 109 public:
110 explicit TestNotificationCallbacks(CredentialManagerClientTest* test) 110 explicit TestNotificationCallbacks(CredentialManagerClientTest* test)
111 : test_(test) {} 111 : test_(test) {}
112 112
113 virtual ~TestNotificationCallbacks() {} 113 virtual ~TestNotificationCallbacks() {}
114 114
115 virtual void onSuccess() { test_->set_callback_succeeded(true); } 115 virtual void onSuccess() OVERRIDE { test_->set_callback_succeeded(true); }
116 116
117 virtual void onError(blink::WebCredentialManagerError* reason) { 117 virtual void onError(blink::WebCredentialManagerError* reason) OVERRIDE {
118 test_->set_callback_errored(true); 118 test_->set_callback_errored(true);
119 } 119 }
120 120
121 private: 121 private:
122 CredentialManagerClientTest* test_; 122 CredentialManagerClientTest* test_;
123 }; 123 };
124 124
125 class TestRequestCallbacks 125 class TestRequestCallbacks
126 : public blink::WebCredentialManagerClient::RequestCallbacks { 126 : public blink::WebCredentialManagerClient::RequestCallbacks {
127 public: 127 public:
128 explicit TestRequestCallbacks(CredentialManagerClientTest* test) 128 explicit TestRequestCallbacks(CredentialManagerClientTest* test)
129 : test_(test) {} 129 : test_(test) {}
130 130
131 virtual ~TestRequestCallbacks() {} 131 virtual ~TestRequestCallbacks() {}
132 132
133 virtual void onSuccess(blink::WebCredential*) { 133 virtual void onSuccess(blink::WebCredential*) OVERRIDE {
134 test_->set_callback_succeeded(true); 134 test_->set_callback_succeeded(true);
135 } 135 }
136 136
137 virtual void onError(blink::WebCredentialManagerError* reason) { 137 virtual void onError(blink::WebCredentialManagerError* reason) OVERRIDE {
138 test_->set_callback_errored(true); 138 test_->set_callback_errored(true);
139 } 139 }
140 140
141 private: 141 private:
142 CredentialManagerClientTest* test_; 142 CredentialManagerClientTest* test_;
143 }; 143 };
144 144
145 } // namespace 145 } // namespace
146 146
147 TEST_F(CredentialManagerClientTest, SendNotifyFailedSignIn) { 147 TEST_F(CredentialManagerClientTest, SendNotifyFailedSignIn) {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 EXPECT_TRUE(ExtractRequestId(CredentialManagerHostMsg_RequestCredential::ID, 207 EXPECT_TRUE(ExtractRequestId(CredentialManagerHostMsg_RequestCredential::ID,
208 request_id)); 208 request_id));
209 209
210 CredentialInfo info; 210 CredentialInfo info;
211 client_->OnSendCredential(request_id, info); 211 client_->OnSendCredential(request_id, info);
212 EXPECT_TRUE(callback_succeeded()); 212 EXPECT_TRUE(callback_succeeded());
213 EXPECT_FALSE(callback_errored()); 213 EXPECT_FALSE(callback_errored());
214 } 214 }
215 215
216 } // namespace password_manager 216 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698