| Index: chrome/browser/notifications/notification_platform_bridge_linux_unittest.cc | 
| diff --git a/chrome/browser/notifications/notification_platform_bridge_linux_unittest.cc b/chrome/browser/notifications/notification_platform_bridge_linux_unittest.cc | 
| index 1ff1192a533a0b7c321d3ef5dfc09345d76bd1f1..aeae250f36ad30a3e50d2f4597dea4e09b2bafb3 100644 | 
| --- a/chrome/browser/notifications/notification_platform_bridge_linux_unittest.cc | 
| +++ b/chrome/browser/notifications/notification_platform_bridge_linux_unittest.cc | 
| @@ -193,6 +193,10 @@ ACTION(OnCloseNotification) { | 
| return dbus::Response::CreateEmpty().release(); | 
| } | 
|  | 
| +ACTION_P(OnNotificationBridgeReady, success) { | 
| +  EXPECT_EQ(success, arg0); | 
| +} | 
| + | 
| // Matches a method call to the specified dbus target. | 
| MATCHER_P(Calls, member, "") { | 
| return arg->GetMember() == member; | 
| @@ -210,30 +214,9 @@ class NotificationPlatformBridgeLinuxTest : public testing::Test { | 
| mock_notification_proxy_ = new StrictMock<dbus::MockObjectProxy>( | 
| mock_bus_.get(), kFreedesktopNotificationsName, | 
| dbus::ObjectPath(kFreedesktopNotificationsPath)); | 
| - | 
| -    EXPECT_CALL(*mock_bus_.get(), | 
| -                GetObjectProxy(kFreedesktopNotificationsName, | 
| -                               dbus::ObjectPath(kFreedesktopNotificationsPath))) | 
| -        .WillOnce(Return(mock_notification_proxy_.get())); | 
| - | 
| -    EXPECT_CALL(*mock_notification_proxy_.get(), | 
| -                MockCallMethodAndBlock(Calls("GetCapabilities"), _)) | 
| -        .WillOnce(OnGetCapabilities(std::vector<std::string>{ | 
| -            "body", "body-hyperlinks", "body-images", "body-markup"})); | 
| - | 
| -    EXPECT_CALL( | 
| -        *mock_notification_proxy_.get(), | 
| -        ConnectToSignal(kFreedesktopNotificationsName, "ActionInvoked", _, _)) | 
| -        .WillOnce(RegisterSignalCallback(&action_invoked_callback_)); | 
| - | 
| -    EXPECT_CALL(*mock_notification_proxy_.get(), | 
| -                ConnectToSignal(kFreedesktopNotificationsName, | 
| -                                "NotificationClosed", _, _)) | 
| -        .WillOnce(RegisterSignalCallback(¬ification_closed_callback_)); | 
| } | 
|  | 
| void TearDown() override { | 
| -    EXPECT_CALL(*mock_bus_.get(), ShutdownAndBlock()); | 
| notification_bridge_linux_->CleanUp(); | 
| content::RunAllBlockingPoolTasksUntilIdle(); | 
| notification_bridge_linux_.reset(); | 
| @@ -243,11 +226,55 @@ class NotificationPlatformBridgeLinuxTest : public testing::Test { | 
|  | 
| protected: | 
| void CreateNotificationBridgeLinux() { | 
| +    CreateNotificationBridgeLinux( | 
| +        std::vector<std::string>{"actions", "body", "body-hyperlinks", | 
| +                                 "body-images", "body-markup"}, | 
| +        true, true, true); | 
| +  } | 
| + | 
| +  void CreateNotificationBridgeLinux( | 
| +      const std::vector<std::string>& capabilities, | 
| +      bool expect_init_success, | 
| +      bool expect_shutdown, | 
| +      bool connect_signals) { | 
| +    EXPECT_CALL(*mock_bus_.get(), | 
| +                GetObjectProxy(kFreedesktopNotificationsName, | 
| +                               dbus::ObjectPath(kFreedesktopNotificationsPath))) | 
| +        .WillOnce(Return(mock_notification_proxy_.get())); | 
| + | 
| +    EXPECT_CALL(*mock_notification_proxy_.get(), | 
| +                MockCallMethodAndBlock(Calls("GetCapabilities"), _)) | 
| +        .WillOnce(OnGetCapabilities(capabilities)); | 
| + | 
| +    if (connect_signals) { | 
| +      EXPECT_CALL( | 
| +          *mock_notification_proxy_.get(), | 
| +          ConnectToSignal(kFreedesktopNotificationsName, "ActionInvoked", _, _)) | 
| +          .WillOnce(RegisterSignalCallback(&action_invoked_callback_)); | 
| + | 
| +      EXPECT_CALL(*mock_notification_proxy_.get(), | 
| +                  ConnectToSignal(kFreedesktopNotificationsName, | 
| +                                  "NotificationClosed", _, _)) | 
| +          .WillOnce(RegisterSignalCallback(¬ification_closed_callback_)); | 
| +    } | 
| + | 
| +    EXPECT_CALL(*this, MockableNotificationBridgeReadyCallback(_)) | 
| +        .WillOnce(OnNotificationBridgeReady(expect_init_success)); | 
| + | 
| +    if (expect_shutdown) | 
| +      EXPECT_CALL(*mock_bus_.get(), ShutdownAndBlock()); | 
| + | 
| notification_bridge_linux_ = | 
| base::WrapUnique(new NotificationPlatformBridgeLinux(mock_bus_)); | 
| +    notification_bridge_linux_->SetReadyCallback( | 
| +        base::BindOnce(&NotificationPlatformBridgeLinuxTest:: | 
| +                           MockableNotificationBridgeReadyCallback, | 
| +                       base::Unretained(this))); | 
| content::RunAllBlockingPoolTasksUntilIdle(); | 
| } | 
|  | 
| +  MOCK_METHOD1(MockableNotificationBridgeReadyCallback, void(bool)); | 
| + | 
| content::TestBrowserThreadBundle thread_bundle_; | 
|  | 
| scoped_refptr<dbus::MockBus> mock_bus_; | 
| @@ -407,3 +434,13 @@ TEST_F(NotificationPlatformBridgeLinuxTest, NotificationAttribution) { | 
| .SetOriginUrl(GURL("https://google.com/search?q=test&ie=UTF8")) | 
| .GetResult()); | 
| } | 
| + | 
| +TEST_F(NotificationPlatformBridgeLinuxTest, MissingActionsCapability) { | 
| +  CreateNotificationBridgeLinux(std::vector<std::string>{"body"}, false, true, | 
| +                                false); | 
| +} | 
| + | 
| +TEST_F(NotificationPlatformBridgeLinuxTest, MissingBodyCapability) { | 
| +  CreateNotificationBridgeLinux(std::vector<std::string>{"actions"}, false, | 
| +                                true, false); | 
| +} | 
|  |