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

Side by Side Diff: third_party/WebKit/Source/modules/credentialmanager/CredentialsContainerTest.cpp

Issue 2864493003: Deprecate CredentialRequestOptions.unmediated in favor mediation enum (Closed)
Patch Set: Rebase Created 3 years, 7 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "modules/credentialmanager/CredentialsContainer.h" 5 #include "modules/credentialmanager/CredentialsContainer.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "bindings/core/v8/V8BindingForTesting.h" 9 #include "bindings/core/v8/V8BindingForTesting.h"
10 #include "bindings/core/v8/V8GCController.h" 10 #include "bindings/core/v8/V8GCController.h"
11 #include "core/dom/Document.h" 11 #include "core/dom/Document.h"
12 #include "modules/credentialmanager/CredentialManagerClient.h" 12 #include "modules/credentialmanager/CredentialManagerClient.h"
13 #include "modules/credentialmanager/CredentialRequestOptions.h" 13 #include "modules/credentialmanager/CredentialRequestOptions.h"
14 #include "public/platform/WebCredential.h" 14 #include "public/platform/WebCredential.h"
15 #include "public/platform/WebCredentialMediationRequirement.h"
15 #include "testing/gmock/include/gmock/gmock.h" 16 #include "testing/gmock/include/gmock/gmock.h"
16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 18
18 namespace blink { 19 namespace blink {
19 20
20 using ::testing::_; 21 using ::testing::_;
21 using ::testing::SaveArg; 22 using ::testing::SaveArg;
22 23
23 namespace { 24 namespace {
24 25
25 class MockCredentialManagerClient : public WebCredentialManagerClient { 26 class MockCredentialManagerClient : public WebCredentialManagerClient {
26 public: 27 public:
27 MOCK_METHOD2(DispatchFailedSignIn, 28 MOCK_METHOD2(DispatchFailedSignIn,
28 void(const WebCredential&, NotificationCallbacks*)); 29 void(const WebCredential&, NotificationCallbacks*));
29 MOCK_METHOD2(DispatchStore, 30 MOCK_METHOD2(DispatchStore,
30 void(const WebCredential&, NotificationCallbacks*)); 31 void(const WebCredential&, NotificationCallbacks*));
31 MOCK_METHOD1(DispatchRequireUserMediation, void(NotificationCallbacks*)); 32 MOCK_METHOD1(DispatchRequireUserMediation, void(NotificationCallbacks*));
32 MOCK_METHOD4(DispatchGet, 33 MOCK_METHOD4(DispatchGet,
33 void(bool, 34 void(WebCredentialMediationRequirement,
34 bool, 35 bool,
35 const WebVector<WebURL>& federations, 36 const WebVector<WebURL>& federations,
36 RequestCallbacks*)); 37 RequestCallbacks*));
37 }; 38 };
38 39
39 } // namespace 40 } // namespace
40 41
41 // Make a call to CredentialsContainer::get(). Destroy v8::Context. 42 // Make a call to CredentialsContainer::get(). Destroy v8::Context.
42 // Make sure that the renderer doesn't crash if got a credential. 43 // Make sure that the renderer doesn't crash if got a credential.
43 TEST(CredentialsContainerTest, TestGetWithDocumentDestroyed) { 44 TEST(CredentialsContainerTest, TestGetWithDocumentDestroyed) {
(...skipping 20 matching lines...) Expand all
64 } 65 }
65 66
66 // Garbage collect v8::Context. 67 // Garbage collect v8::Context.
67 V8GCController::CollectAllGarbageForTesting(v8::Isolate::GetCurrent()); 68 V8GCController::CollectAllGarbageForTesting(v8::Isolate::GetCurrent());
68 69
69 // Invoking the callback shouldn't crash. 70 // Invoking the callback shouldn't crash.
70 get_callback->OnSuccess(std::unique_ptr<WebCredential>()); 71 get_callback->OnSuccess(std::unique_ptr<WebCredential>());
71 } 72 }
72 73
73 } // namespace blink 74 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/credentialmanager/CredentialsContainer.cpp ('k') | third_party/WebKit/public/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698