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

Side by Side Diff: chromeos/dbus/dbus_client_bundle_unittest.cc

Issue 2319783002: mash: Allow a subset of D-Bus clients to be created in DBusThreadManager (Closed)
Patch Set: WIP, add DBusThreadManagerAsh and DBusThreadManagerChrome Created 4 years, 3 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 | « chromeos/dbus/dbus_client_bundle.cc ('k') | chromeos/dbus/dbus_client_implementation_type.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chromeos/dbus/dbus_client_bundle.h" 5 #include "chromeos/dbus/dbus_client_bundle.h"
6 6
7 #include "base/compiler_specific.h"
8 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
9 8
10 namespace chromeos { 9 namespace chromeos {
11 10
11 // Tests that real and fake clients can be created and that some clients can be
12 // skipped.
13 TEST(DBusClientBundleTest, CreateClientBundle) {
14 const DBusClientTypeMask real_clients =
15 DBusClientBundle::CRAS | DBusClientBundle::CROS_DISKS;
16 const DBusClientTypeMask fake_clients =
17 DBusClientBundle::PERMISSION_BROKER | DBusClientBundle::POWER_MANAGER;
18 DBusClientBundle bundle(real_clients, fake_clients);
19 EXPECT_TRUE(bundle.IsUsingAnyRealClient());
20
21 // Real clients are real.
22 EXPECT_TRUE(bundle.cras_audio_client());
23 EXPECT_TRUE(bundle.cros_disks_client());
24 EXPECT_TRUE(bundle.IsUsingReal(DBusClientBundle::CRAS));
25 EXPECT_TRUE(bundle.IsUsingReal(DBusClientBundle::CROS_DISKS));
26 EXPECT_FALSE(bundle.IsUsingFake(DBusClientBundle::CRAS));
27 EXPECT_FALSE(bundle.IsUsingFake(DBusClientBundle::CROS_DISKS));
28
29 // Fake clients are fake.
30 EXPECT_TRUE(bundle.permission_broker_client());
31 EXPECT_TRUE(bundle.power_manager_client());
32 EXPECT_TRUE(bundle.IsUsingFake(DBusClientBundle::PERMISSION_BROKER));
33 EXPECT_TRUE(bundle.IsUsingFake(DBusClientBundle::POWER_MANAGER));
34 EXPECT_FALSE(bundle.IsUsingReal(DBusClientBundle::PERMISSION_BROKER));
35 EXPECT_FALSE(bundle.IsUsingReal(DBusClientBundle::POWER_MANAGER));
36
37 // Uninitialized clients don't exist.
38 EXPECT_FALSE(bundle.update_engine_client());
39 EXPECT_FALSE(bundle.IsUsingReal(DBusClientBundle::UPDATE_ENGINE));
40 EXPECT_FALSE(bundle.IsUsingFake(DBusClientBundle::UPDATE_ENGINE));
41 }
42
12 TEST(DBusClientBundleTest, UnstubFlagParser) { 43 TEST(DBusClientBundleTest, UnstubFlagParser) {
13 EXPECT_EQ(0, DBusClientBundle::ParseUnstubList("foo")); 44 EXPECT_EQ(0, DBusClientBundle::ParseUnstubList("foo"));
14 45
15 EXPECT_EQ(DBusClientBundle::BLUETOOTH, 46 EXPECT_EQ(DBusClientBundle::BLUETOOTH,
16 DBusClientBundle::ParseUnstubList("BLUETOOTH")); 47 DBusClientBundle::ParseUnstubList("BLUETOOTH"));
17 48
18 EXPECT_EQ(DBusClientBundle::BLUETOOTH, 49 EXPECT_EQ(DBusClientBundle::BLUETOOTH,
19 DBusClientBundle::ParseUnstubList("bluetooth")); 50 DBusClientBundle::ParseUnstubList("bluetooth"));
20 51
21 EXPECT_EQ( 52 EXPECT_EQ(
22 DBusClientBundle::CRAS | 53 DBusClientBundle::CRAS |
23 DBusClientBundle::CROS_DISKS | 54 DBusClientBundle::CROS_DISKS |
24 DBusClientBundle::DEBUG_DAEMON | 55 DBusClientBundle::DEBUG_DAEMON |
25 DBusClientBundle::SHILL, 56 DBusClientBundle::SHILL,
26 DBusClientBundle::ParseUnstubList( 57 DBusClientBundle::ParseUnstubList(
27 "Cras,Cros_Disks,debug_daemon,Shill")); 58 "Cras,Cros_Disks,debug_daemon,Shill"));
28 59
29 EXPECT_EQ( 60 EXPECT_EQ(
30 DBusClientBundle::CRAS | 61 DBusClientBundle::CRAS |
31 DBusClientBundle::CROS_DISKS | 62 DBusClientBundle::CROS_DISKS |
32 DBusClientBundle::DEBUG_DAEMON | 63 DBusClientBundle::DEBUG_DAEMON |
33 DBusClientBundle::SHILL, 64 DBusClientBundle::SHILL,
34 DBusClientBundle::ParseUnstubList( 65 DBusClientBundle::ParseUnstubList(
35 "foo,Cras,Cros_Disks,debug_daemon,Shill")); 66 "foo,Cras,Cros_Disks,debug_daemon,Shill"));
36 } 67 }
37 68
38 } // namespace chromeos 69 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/dbus_client_bundle.cc ('k') | chromeos/dbus/dbus_client_implementation_type.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698