| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 void RunMenuAtCallback() { | 161 void RunMenuAtCallback() { |
| 162 NSArray* subviews = [parent_->GetNativeView() subviews]; | 162 NSArray* subviews = [parent_->GetNativeView() subviews]; |
| 163 EXPECT_EQ(2u, [subviews count]); | 163 EXPECT_EQ(2u, [subviews count]); |
| 164 last_anchor_frame_ = [[subviews objectAtIndex:1] frame]; | 164 last_anchor_frame_ = [[subviews objectAtIndex:1] frame]; |
| 165 runner_->Cancel(); | 165 runner_->Cancel(); |
| 166 } | 166 } |
| 167 | 167 |
| 168 DISALLOW_COPY_AND_ASSIGN(MenuRunnerCocoaTest); | 168 DISALLOW_COPY_AND_ASSIGN(MenuRunnerCocoaTest); |
| 169 }; | 169 }; |
| 170 | 170 |
| 171 TEST_F(MenuRunnerCocoaTest, RunMenuAndCancel) { | 171 TEST_F(MenuRunnerCocoaTest, DISABLED_RunMenuAndCancel) { |
| 172 base::TimeTicks min_time = ui::EventTimeForNow(); | 172 base::TimeTicks min_time = ui::EventTimeForNow(); |
| 173 | 173 |
| 174 MenuRunner::RunResult result = RunMenu(base::Bind( | 174 MenuRunner::RunResult result = RunMenu(base::Bind( |
| 175 &MenuRunnerCocoaTest::MenuCancelCallback, base::Unretained(this))); | 175 &MenuRunnerCocoaTest::MenuCancelCallback, base::Unretained(this))); |
| 176 | 176 |
| 177 EXPECT_EQ(MenuRunner::NORMAL_EXIT, result); | 177 EXPECT_EQ(MenuRunner::NORMAL_EXIT, result); |
| 178 EXPECT_FALSE(runner_->IsRunning()); | 178 EXPECT_FALSE(runner_->IsRunning()); |
| 179 | 179 |
| 180 EXPECT_GE(runner_->GetClosingEventTime(), min_time); | 180 EXPECT_GE(runner_->GetClosingEventTime(), min_time); |
| 181 EXPECT_LE(runner_->GetClosingEventTime(), ui::EventTimeForNow()); | 181 EXPECT_LE(runner_->GetClosingEventTime(), ui::EventTimeForNow()); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 // 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 |
| 258 // 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 |
| 259 // skipped, to give a better match to native behavior. | 259 // skipped, to give a better match to native behavior. |
| 260 base::i18n::SetICUDefaultLocale("he"); | 260 base::i18n::SetICUDefaultLocale("he"); |
| 261 RunMenuAt(anchor_rect); | 261 RunMenuAt(anchor_rect); |
| 262 EXPECT_EQ(combobox_rect.right(), last_anchor_frame_.origin.x); | 262 EXPECT_EQ(combobox_rect.right(), last_anchor_frame_.origin.x); |
| 263 } | 263 } |
| 264 | 264 |
| 265 } // namespace test | 265 } // namespace test |
| 266 } // namespace views | 266 } // namespace views |
| OLD | NEW |