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

Side by Side Diff: chrome/browser/webauth/authenticator_web_contents_manager_unittest.cc

Issue 2788823002: Add the Mojo implementation of authenticator.mojom's MakeCredential. (Closed)
Patch Set: Address comments on unittests Created 3 years, 5 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/webauth/authenticator_web_contents_manager.h"
6
7 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
8 #include "components/webauth/authenticator_impl.h"
9 #include "content/public/browser/render_process_host.h"
10 #include "content/public/browser/web_contents.h"
11 #include "testing/gmock/include/gmock/gmock.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13
14 using ::testing::_;
15
16 using webauth::mojom::AuthenticatorPtr;
17
18 class AuthenticatorManagerTest : public ChromeRenderViewHostTestHarness {
19 public:
20 AuthenticatorManagerTest() {}
21 ~AuthenticatorManagerTest() override {}
22
23 private:
24 void SetUp() override { ChromeRenderViewHostTestHarness::SetUp(); }
25
26 void TearDown() override { ChromeRenderViewHostTestHarness::TearDown(); }
27 };
28
29 // Test that the manager can be created.
30 TEST_F(AuthenticatorManagerTest, CreateForWebContents) {
31 AuthenticatorWebContentsManager* manager =
32 AuthenticatorWebContentsManager::GetOrCreateForWebContents(
33 web_contents());
34 ASSERT_NE(manager, nullptr);
35 }
36
37 // Test that the manager creates an authenticator.
38 TEST_F(AuthenticatorManagerTest, CreateAuthenticator) {
39 AuthenticatorPtr authenticator;
40 AuthenticatorPtr nullInterface;
41 AuthenticatorWebContentsManager::GetOrCreateForWebContents(web_contents())
42 ->CreateAuthenticator(main_rfh(), mojo::MakeRequest(&authenticator));
43 EXPECT_FALSE(authenticator.Equals(nullInterface));
44 }
45
46 // Test that the same AuthenticatorManager is returned for the same web content.
47 TEST_F(AuthenticatorManagerTest, MultipleManagers) {
48 AuthenticatorWebContentsManager* manager =
49 AuthenticatorWebContentsManager::GetOrCreateForWebContents(
50 web_contents());
51 AuthenticatorWebContentsManager* manager2 =
52 AuthenticatorWebContentsManager::GetOrCreateForWebContents(
53 web_contents());
54 EXPECT_TRUE(manager == manager2);
55 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698