| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This test is relatively complicated. Here's the summary of what it does: | 5 // This test is relatively complicated. Here's the summary of what it does: |
| 6 // | 6 // |
| 7 // - Set up mock D-Bus related objects to mock out D-Bus calls. | 7 // - Set up mock D-Bus related objects to mock out D-Bus calls. |
| 8 // - Set up a mock proxy resolver to mock out the proxy resolution. | 8 // - Set up a mock proxy resolver to mock out the proxy resolution. |
| 9 // - Create ProxyResolutionServiceProvider by injecting the mocks | 9 // - Create ProxyResolutionServiceProvider by injecting the mocks |
| 10 // - Start the service provider. | 10 // - Start the service provider. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 options.bus_type = dbus::Bus::SYSTEM; | 73 options.bus_type = dbus::Bus::SYSTEM; |
| 74 mock_bus_ = new dbus::MockBus(options); | 74 mock_bus_ = new dbus::MockBus(options); |
| 75 | 75 |
| 76 // ShutdownAndBlock() will be called in TearDown(). | 76 // ShutdownAndBlock() will be called in TearDown(). |
| 77 EXPECT_CALL(*mock_bus_, ShutdownAndBlock()).WillOnce(Return()); | 77 EXPECT_CALL(*mock_bus_, ShutdownAndBlock()).WillOnce(Return()); |
| 78 | 78 |
| 79 // Create a mock exported object that behaves as | 79 // Create a mock exported object that behaves as |
| 80 // org.chromium.CrosDBusService. | 80 // org.chromium.CrosDBusService. |
| 81 mock_exported_object_ = | 81 mock_exported_object_ = |
| 82 new dbus::MockExportedObject(mock_bus_.get(), | 82 new dbus::MockExportedObject(mock_bus_.get(), |
| 83 kLibCrosServiceName, | |
| 84 dbus::ObjectPath(kLibCrosServicePath)); | 83 dbus::ObjectPath(kLibCrosServicePath)); |
| 85 | 84 |
| 86 // |mock_exported_object_|'s ExportMethod() will use | 85 // |mock_exported_object_|'s ExportMethod() will use |
| 87 // |MockExportedObject(). | 86 // |MockExportedObject(). |
| 88 EXPECT_CALL( | 87 EXPECT_CALL( |
| 89 *mock_exported_object_, | 88 *mock_exported_object_, |
| 90 ExportMethod(_, _, _, _)).WillOnce( | 89 ExportMethod(_, _, _, _)).WillOnce( |
| 91 Invoke(this, | 90 Invoke(this, |
| 92 &ProxyResolutionServiceProviderTest::MockExportMethod)); | 91 &ProxyResolutionServiceProviderTest::MockExportMethod)); |
| 93 // |mock_exported_object_|'s SendSignal() will use | 92 // |mock_exported_object_|'s SendSignal() will use |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 ASSERT_TRUE(response.get()); | 321 ASSERT_TRUE(response.get()); |
| 323 dbus::MessageReader reader(response.get()); | 322 dbus::MessageReader reader(response.get()); |
| 324 ASSERT_FALSE(reader.HasMoreData()); | 323 ASSERT_FALSE(reader.HasMoreData()); |
| 325 | 324 |
| 326 // Confirm that the signal is received successfully. | 325 // Confirm that the signal is received successfully. |
| 327 // The contents of the signal are checked in OnSignalReceived(). | 326 // The contents of the signal are checked in OnSignalReceived(). |
| 328 ASSERT_TRUE(signal_received_successfully_); | 327 ASSERT_TRUE(signal_received_successfully_); |
| 329 } | 328 } |
| 330 | 329 |
| 331 } // namespace chromeos | 330 } // namespace chromeos |
| OLD | NEW |