| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "ui/views/controls/menu/menu_runner_impl_cocoa.h" | 5 #import "ui/views/controls/menu/menu_runner_impl_cocoa.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 MenuRunner::RunResult result = runner_->RunMenuAt( | 122 MenuRunner::RunResult result = runner_->RunMenuAt( |
| 123 parent_, nullptr, anchor, MENU_ANCHOR_TOPLEFT, MenuRunner::COMBOBOX); | 123 parent_, nullptr, anchor, MENU_ANCHOR_TOPLEFT, MenuRunner::COMBOBOX); |
| 124 | 124 |
| 125 // Ensure the anchor view is removed. | 125 // Ensure the anchor view is removed. |
| 126 EXPECT_EQ(1u, [[parent_->GetNativeView() subviews] count]); | 126 EXPECT_EQ(1u, [[parent_->GetNativeView() subviews] count]); |
| 127 return result; | 127 return result; |
| 128 } | 128 } |
| 129 | 129 |
| 130 void MenuCancelCallback() { | 130 void MenuCancelCallback() { |
| 131 runner_->Cancel(); | 131 runner_->Cancel(); |
| 132 EXPECT_FALSE(runner_->IsRunning()); | 132 // For a syncronous menu, MenuRunner::IsRunning() should return true |
| 133 // immediately after MenuRunner::Cancel() since the menu message loop has |
| 134 // not yet terminated. It has only been marked for termination. |
| 135 EXPECT_TRUE(runner_->IsRunning()); |
| 133 } | 136 } |
| 134 | 137 |
| 135 void MenuDeleteCallback() { | 138 void MenuDeleteCallback() { |
| 136 runner_->Release(); | 139 runner_->Release(); |
| 137 runner_ = nullptr; | 140 runner_ = nullptr; |
| 138 } | 141 } |
| 139 | 142 |
| 140 void MenuCancelAndDeleteCallback() { | 143 void MenuCancelAndDeleteCallback() { |
| 141 runner_->Cancel(); | 144 runner_->Cancel(); |
| 142 runner_->Release(); | 145 runner_->Release(); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 // In RTL, Cocoa messes up the positioning unless the anchor rectangle is | 257 // In RTL, Cocoa messes up the positioning unless the anchor rectangle is |
| 255 // offset to the right of the view. The offset for the checkmark is also | 258 // offset to the right of the view. The offset for the checkmark is also |
| 256 // skipped, to give a better match to native behavior. | 259 // skipped, to give a better match to native behavior. |
| 257 base::i18n::SetICUDefaultLocale("he"); | 260 base::i18n::SetICUDefaultLocale("he"); |
| 258 RunMenuAt(anchor_rect); | 261 RunMenuAt(anchor_rect); |
| 259 EXPECT_EQ(combobox_rect.right(), last_anchor_frame_.origin.x); | 262 EXPECT_EQ(combobox_rect.right(), last_anchor_frame_.origin.x); |
| 260 } | 263 } |
| 261 | 264 |
| 262 } // namespace test | 265 } // namespace test |
| 263 } // namespace views | 266 } // namespace views |
| OLD | NEW |