| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #import "ios/chrome/browser/installation_notifier.h" | 5 #import "ios/chrome/browser/installation_notifier.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
| 9 | 9 |
| 10 #include "base/ios/block_types.h" | 10 #include "base/ios/block_types.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 50 + jitter * expectedDelayInMSec); | 144 50 + jitter * expectedDelayInMSec); |
| 145 } | 145 } |
| 146 | 146 |
| 147 base::MessageLoopForUI message_loop_; | 147 base::MessageLoopForUI message_loop_; |
| 148 web::TestWebThread ui_thread_; | 148 web::TestWebThread ui_thread_; |
| 149 InstallationNotifier* installationNotifier_; // Weak pointer to singleton. | 149 InstallationNotifier* installationNotifier_; // Weak pointer to singleton. |
| 150 MockDispatcher* dispatcher_; // Weak. installationNotifier_ owns it. | 150 MockDispatcher* dispatcher_; // Weak. installationNotifier_ owns it. |
| 151 base::scoped_nsobject<MockNotificationReceiver> notificationReceiver1_; | 151 base::scoped_nsobject<MockNotificationReceiver> notificationReceiver1_; |
| 152 base::scoped_nsobject<MockNotificationReceiver> notificationReceiver2_; | 152 base::scoped_nsobject<MockNotificationReceiver> notificationReceiver2_; |
| 153 base::scoped_nsobject<MockUIApplication> sharedApplication_; | 153 base::scoped_nsobject<MockUIApplication> sharedApplication_; |
| 154 scoped_ptr<base::HistogramTester> histogramTester_; | 154 std::unique_ptr<base::HistogramTester> histogramTester_; |
| 155 }; | 155 }; |
| 156 | 156 |
| 157 TEST_F(InstallationNotifierTest, RegisterWithAppAlreadyInstalled) { | 157 TEST_F(InstallationNotifierTest, RegisterWithAppAlreadyInstalled) { |
| 158 [sharedApplication_ setCanOpenURL:YES]; | 158 [sharedApplication_ setCanOpenURL:YES]; |
| 159 [installationNotifier_ | 159 [installationNotifier_ |
| 160 registerForInstallationNotifications:notificationReceiver1_ | 160 registerForInstallationNotifications:notificationReceiver1_ |
| 161 withSelector:@selector(receivedNotification) | 161 withSelector:@selector(receivedNotification) |
| 162 forScheme:@"foo-scheme"]; | 162 forScheme:@"foo-scheme"]; |
| 163 EXPECT_EQ(1, [notificationReceiver1_ notificationCount]); | 163 EXPECT_EQ(1, [notificationReceiver1_ notificationCount]); |
| 164 [installationNotifier_ | 164 [installationNotifier_ |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 271 |
| 272 TEST_F(InstallationNotifierTest, TestThatEmptySchemeDoesntCrashChrome) { | 272 TEST_F(InstallationNotifierTest, TestThatEmptySchemeDoesntCrashChrome) { |
| 273 [installationNotifier_ | 273 [installationNotifier_ |
| 274 registerForInstallationNotifications:notificationReceiver1_ | 274 registerForInstallationNotifications:notificationReceiver1_ |
| 275 withSelector:@selector(receivedNotification) | 275 withSelector:@selector(receivedNotification) |
| 276 forScheme:nil]; | 276 forScheme:nil]; |
| 277 [installationNotifier_ unregisterForNotifications:notificationReceiver1_]; | 277 [installationNotifier_ unregisterForNotifications:notificationReceiver1_]; |
| 278 } | 278 } |
| 279 | 279 |
| 280 } // namespace | 280 } // namespace |
| OLD | NEW |