OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "accounts_db_manager.h" | 5 #include "accounts_db_manager.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_tokenizer.h" | 8 #include "base/strings/string_tokenizer.h" |
9 #include "mojo/public/cpp/application/application_impl.h" | 9 #include "mojo/public/cpp/application/application_impl.h" |
10 #include "mojo/public/cpp/application/application_test_base.h" | 10 #include "mojo/public/cpp/application/application_test_base.h" |
11 #include "mojo/services/files/interfaces/types.mojom.h" | 11 #include "mojo/services/files/interfaces/types.mojom.h" |
12 #include "services/authentication/credentials_impl_db.mojom.h" | 12 #include "services/authentication/credentials_impl_db.mojom.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 namespace authentication { | 15 namespace authentication { |
16 namespace { | 16 namespace { |
17 | 17 |
18 class AccountsDBTest : public mojo::test::ApplicationTestBase { | 18 class AccountsDBTest : public mojo::test::ApplicationTestBase { |
19 public: | 19 public: |
20 AccountsDBTest(){}; | 20 AccountsDBTest(){}; |
21 ~AccountsDBTest() override{}; | 21 ~AccountsDBTest() override{}; |
22 | 22 |
23 protected: | 23 protected: |
24 void SetUp() override { | 24 void SetUp() override { |
25 mojo::test::ApplicationTestBase::SetUp(); | 25 mojo::test::ApplicationTestBase::SetUp(); |
26 mojo::files::FilesPtr files; | 26 mojo::files::FilesPtr files; |
27 application_impl()->ConnectToService("mojo:files", &files); | 27 application_impl()->ConnectToServiceDeprecated("mojo:files", &files); |
28 | 28 |
29 mojo::files::Error error = mojo::files::Error::INTERNAL; | 29 mojo::files::Error error = mojo::files::Error::INTERNAL; |
30 mojo::files::DirectoryPtr directory; | 30 mojo::files::DirectoryPtr directory; |
31 files->OpenFileSystem(nullptr, GetProxy(&directory), | 31 files->OpenFileSystem(nullptr, GetProxy(&directory), |
32 [&error](mojo::files::Error e) { error = e; }); | 32 [&error](mojo::files::Error e) { error = e; }); |
33 CHECK(files.WaitForIncomingResponse()); | 33 CHECK(files.WaitForIncomingResponse()); |
34 CHECK_EQ(mojo::files::Error::OK, error); | 34 CHECK_EQ(mojo::files::Error::OK, error); |
35 | 35 |
36 accounts_db_manager_ = new AccountsDbManager(directory.Pass()); | 36 accounts_db_manager_ = new AccountsDbManager(directory.Pass()); |
37 } | 37 } |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 } | 151 } |
152 | 152 |
153 TEST_F(AccountsDBTest, CanGetAuthorizedUserForInvalidApp) { | 153 TEST_F(AccountsDBTest, CanGetAuthorizedUserForInvalidApp) { |
154 accountsDBPtr()->UpdateAuthorization("url1", "user1"); | 154 accountsDBPtr()->UpdateAuthorization("url1", "user1"); |
155 ASSERT_TRUE( | 155 ASSERT_TRUE( |
156 accountsDBPtr()->GetAuthorizedUserForApp("invalid_app_url").is_null()); | 156 accountsDBPtr()->GetAuthorizedUserForApp("invalid_app_url").is_null()); |
157 } | 157 } |
158 | 158 |
159 } // namespace | 159 } // namespace |
160 } // namespace authentication | 160 } // namespace authentication |
OLD | NEW |