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

Side by Side Diff: components/download/internal/client_set_unittest.cc

Issue 2895953004: Add initial Controller to DownloadService (Closed)
Patch Set: Rebased Created 3 years, 6 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
« no previous file with comments | « components/download/internal/client_set.cc ('k') | components/download/internal/config.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "components/download/internal/client_set.h"
6
7 #include <algorithm>
8
9 #include "base/memory/ptr_util.h"
10 #include "components/download/internal/test/empty_client.h"
11 #include "components/download/public/clients.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13
14 namespace download {
15
16 TEST(DownloadServiceClientSetTest, TestGetClient) {
17 auto client = base::MakeUnique<test::EmptyClient>();
18 Client* raw_client = client.get();
19
20 auto client_map = base::MakeUnique<DownloadClientMap>();
21 client_map->insert(std::make_pair(DownloadClient::TEST, std::move(client)));
22 ClientSet clients(std::move(client_map));
23
24 EXPECT_EQ(raw_client, clients.GetClient(DownloadClient::TEST));
25 EXPECT_EQ(nullptr, clients.GetClient(DownloadClient::INVALID));
26 }
27
28 TEST(DownloadServiceClientSetTest, TestGetRegisteredClients) {
29 auto client = base::MakeUnique<test::EmptyClient>();
30
31 auto client_map = base::MakeUnique<DownloadClientMap>();
32 client_map->insert(std::make_pair(DownloadClient::TEST, std::move(client)));
33 ClientSet clients(std::move(client_map));
34
35 std::set<DownloadClient> expected_set = {DownloadClient::TEST};
36 std::set<DownloadClient> actual_set = clients.GetRegisteredClients();
37
38 EXPECT_EQ(expected_set.size(), actual_set.size());
39 EXPECT_TRUE(
40 std::equal(expected_set.begin(), expected_set.end(), actual_set.begin()));
41 }
42
43 } // namespace download
OLDNEW
« no previous file with comments | « components/download/internal/client_set.cc ('k') | components/download/internal/config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698