Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/test/app/chrome_test_util.h" | 5 #import "ios/chrome/test/app/chrome_test_util.h" |
| 6 | 6 |
| 7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
| 8 #import "breakpad/src/client/ios/BreakpadController.h" | 8 #import "breakpad/src/client/ios/BreakpadController.h" |
| 9 #include "components/metrics/metrics_pref_names.h" | 9 #include "components/metrics/metrics_pref_names.h" |
| 10 #include "components/metrics/metrics_service.h" | 10 #include "components/metrics/metrics_service.h" |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" | 24 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" |
| 25 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" | 25 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" |
| 26 #import "ios/chrome/browser/ui/main/main_view_controller.h" | 26 #import "ios/chrome/browser/ui/main/main_view_controller.h" |
| 27 #import "ios/chrome/browser/ui/ntp/new_tab_page_controller.h" | 27 #import "ios/chrome/browser/ui/ntp/new_tab_page_controller.h" |
| 28 #import "ios/web/public/test/native_controller_test_util.h" | 28 #import "ios/web/public/test/native_controller_test_util.h" |
| 29 | 29 |
| 30 // Methods to access private members for testing. | 30 // Methods to access private members for testing. |
| 31 @interface BreakpadController (Testing) | 31 @interface BreakpadController (Testing) |
| 32 - (BOOL)isEnabled; | 32 - (BOOL)isEnabled; |
| 33 - (BOOL)isUploadingEnabled; | 33 - (BOOL)isUploadingEnabled; |
| 34 - (dispatch_queue_t)queue; | |
|
baxley
2017/04/20 16:37:42
Probably outside the scope of this CL... Do you ha
| |
| 34 @end | 35 @end |
| 35 @implementation BreakpadController (Testing) | 36 @implementation BreakpadController (Testing) |
| 36 - (BOOL)isEnabled { | 37 - (BOOL)isEnabled { |
| 37 return started_; | 38 return started_; |
| 38 } | 39 } |
| 39 - (BOOL)isUploadingEnabled { | 40 - (BOOL)isUploadingEnabled { |
| 40 return enableUploads_; | 41 return enableUploads_; |
| 41 } | 42 } |
| 43 - (dispatch_queue_t)queue { | |
| 44 return queue_; | |
| 45 } | |
| 42 @end | 46 @end |
| 43 | 47 |
| 44 namespace { | 48 namespace { |
| 45 // Returns the current tab model. | 49 // Returns the current tab model. |
| 46 TabModel* GetCurrentTabModel() { | 50 TabModel* GetCurrentTabModel() { |
| 47 MainController* main_controller = chrome_test_util::GetMainController(); | 51 MainController* main_controller = chrome_test_util::GetMainController(); |
| 48 DCHECK(main_controller); | 52 DCHECK(main_controller); |
| 49 BrowserViewController* main_bvc = | 53 BrowserViewController* main_bvc = |
| 50 [[main_controller browserViewInformation] mainBVC]; | 54 [[main_controller browserViewInformation] mainBVC]; |
| 51 BrowserViewController* current_bvc = | 55 BrowserViewController* current_bvc = |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 } | 198 } |
| 195 | 199 |
| 196 bool IsBreakpadReportingEnabled() { | 200 bool IsBreakpadReportingEnabled() { |
| 197 return [[BreakpadController sharedInstance] isUploadingEnabled]; | 201 return [[BreakpadController sharedInstance] isUploadingEnabled]; |
| 198 } | 202 } |
| 199 | 203 |
| 200 bool IsFirstLaunchAfterUpgrade() { | 204 bool IsFirstLaunchAfterUpgrade() { |
| 201 return [chrome_test_util::GetMainController() isFirstLaunchAfterUpgrade]; | 205 return [chrome_test_util::GetMainController() isFirstLaunchAfterUpgrade]; |
| 202 } | 206 } |
| 203 | 207 |
| 208 void WaitForBreakpadQueue() { | |
| 209 dispatch_queue_t queue = [[BreakpadController sharedInstance] queue]; | |
| 210 dispatch_barrier_sync(queue, ^{ | |
| 211 }); | |
| 212 } | |
| 213 | |
| 204 void OpenChromeFromExternalApp(const GURL& url) { | 214 void OpenChromeFromExternalApp(const GURL& url) { |
| 205 [[[UIApplication sharedApplication] delegate] | 215 [[[UIApplication sharedApplication] delegate] |
| 206 applicationWillResignActive:[UIApplication sharedApplication]]; | 216 applicationWillResignActive:[UIApplication sharedApplication]]; |
| 207 [GetMainController() setStartupParametersWithURL:url]; | 217 [GetMainController() setStartupParametersWithURL:url]; |
| 208 | 218 |
| 209 [[[UIApplication sharedApplication] delegate] | 219 [[[UIApplication sharedApplication] delegate] |
| 210 applicationDidBecomeActive:[UIApplication sharedApplication]]; | 220 applicationDidBecomeActive:[UIApplication sharedApplication]]; |
| 211 } | 221 } |
| 212 | 222 |
| 213 } // namespace chrome_test_util | 223 } // namespace chrome_test_util |
| OLD | NEW |