Index: chrome/test/base/interactive_test_utils_mac.mm |
diff --git a/chrome/test/base/interactive_test_utils_mac.mm b/chrome/test/base/interactive_test_utils_mac.mm |
index fcf5f124f1f1e719067dafe11595c758642694f5..424f98afd9a84143e38521cb3d1aea03b65c9b9a 100644 |
--- a/chrome/test/base/interactive_test_utils_mac.mm |
+++ b/chrome/test/base/interactive_test_utils_mac.mm |
@@ -54,6 +54,13 @@ bool IsViewFocused(const Browser* browser, ViewID vid) { |
if (firstResponder == static_cast<NSResponder*>(view)) |
return true; |
+ // Handle special case for VIEW_ID_TAB_CONTAINER. The tab container NSView |
+ // always transfers first responder status to its subview, so test whether |
+ // |firstResponder| is a descendant. |
+ if (vid == VIEW_ID_TAB_CONTAINER && |
+ [firstResponder isKindOfClass:[NSView class]]) |
+ return [static_cast<NSView*>(firstResponder) isDescendantOf:view]; |
+ |
// Handle the special case of focusing a TextField. |
if ([firstResponder isKindOfClass:[NSTextView class]]) { |
NSView* delegate = static_cast<NSView*>([(NSTextView*)firstResponder |