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
3 // found in the LICENSE file.
5 #include "ui/base/test/ios/ui_view_test_utils.h"
7 #include "base/logging.h"
11 namespace uiview_utils {
14 for (UIWindow* window in [UIApplication sharedApplication].windows) {
15 for (UIView* view in [window subviews]) {
16 if ([view isKindOfClass:[UIAlertView class]]) {
17 UIAlertView* alertView = (UIAlertView*)view;
18 [alertView dismissWithClickedButtonIndex:0 animated:NO];
24 void ForceViewRendering(UIView* view) {
26 CALayer* layer = view.layer;
28 // 19 is an arbitrary non-zero value.
29 UIGraphicsBeginImageContext(CGSizeMake(19, 19));
30 CGContext* context = UIGraphicsGetCurrentContext();
32 [layer renderInContext:context];
33 UIGraphicsEndImageContext();
36 } // namespace uiview_utils