OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/ui/cocoa/extensions/toolbar_actions_bar_bubble_mac.h" |
5 #include "base/logging.h" | 6 #include "base/logging.h" |
6 #import "base/mac/foundation_util.h" | 7 #import "base/mac/foundation_util.h" |
7 #import "base/mac/scoped_nsobject.h" | 8 #import "base/mac/scoped_nsobject.h" |
8 #include "base/macros.h" | 9 #include "base/macros.h" |
9 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
11 #import "chrome/browser/ui/cocoa/extensions/toolbar_actions_bar_bubble_mac.h" | |
12 #import "chrome/browser/ui/cocoa/test/cocoa_test_helper.h" | 12 #import "chrome/browser/ui/cocoa/test/cocoa_test_helper.h" |
13 #include "chrome/browser/ui/cocoa/test/run_loop_testing.h" | 13 #include "chrome/browser/ui/cocoa/test/run_loop_testing.h" |
14 #include "chrome/browser/ui/toolbar/test_toolbar_actions_bar_bubble_delegate.h" | 14 #include "chrome/browser/ui/toolbar/test_toolbar_actions_bar_bubble_delegate.h" |
15 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
16 #include "components/grit/components_scaled_resources.h" | 16 #include "components/grit/components_scaled_resources.h" |
17 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
18 #import "ui/events/test/cocoa_test_event_utils.h" | 18 #import "ui/events/test/cocoa_test_event_utils.h" |
19 #include "ui/gfx/vector_icons_public.h" | 19 #include "ui/vector_icons/vector_icons.h" |
20 | 20 |
21 // A simple class to observe when a window is destructing. | 21 // A simple class to observe when a window is destructing. |
22 @interface WindowObserver : NSObject { | 22 @interface WindowObserver : NSObject { |
23 BOOL windowIsClosing_; | 23 BOOL windowIsClosing_; |
24 } | 24 } |
25 | 25 |
26 - (id)initWithWindow:(NSWindow*)window; | 26 - (id)initWithWindow:(NSWindow*)window; |
27 | 27 |
28 - (void)dealloc; | 28 - (void)dealloc; |
29 | 29 |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 } | 275 } |
276 | 276 |
277 // Test with an extra view of a (unlinked) text and icon and action button. | 277 // Test with an extra view of a (unlinked) text and icon and action button. |
278 { | 278 { |
279 TestToolbarActionsBarBubbleDelegate delegate(HeadingString(), BodyString(), | 279 TestToolbarActionsBarBubbleDelegate delegate(HeadingString(), BodyString(), |
280 ActionString()); | 280 ActionString()); |
281 | 281 |
282 std::unique_ptr<ToolbarActionsBarBubbleDelegate::ExtraViewInfo> | 282 std::unique_ptr<ToolbarActionsBarBubbleDelegate::ExtraViewInfo> |
283 extra_view_info = | 283 extra_view_info = |
284 base::MakeUnique<ToolbarActionsBarBubbleDelegate::ExtraViewInfo>(); | 284 base::MakeUnique<ToolbarActionsBarBubbleDelegate::ExtraViewInfo>(); |
285 extra_view_info->resource_id = gfx::VectorIconId::BUSINESS; | 285 extra_view_info->resource = &ui::kBusinessIcon; |
286 extra_view_info->text = | 286 extra_view_info->text = |
287 l10n_util::GetStringUTF16(IDS_EXTENSIONS_INSTALLED_BY_ADMIN); | 287 l10n_util::GetStringUTF16(IDS_EXTENSIONS_INSTALLED_BY_ADMIN); |
288 extra_view_info->is_text_linked = false; | 288 extra_view_info->is_text_linked = false; |
289 delegate.set_extra_view_info(std::move(extra_view_info)); | 289 delegate.set_extra_view_info(std::move(extra_view_info)); |
290 | 290 |
291 ToolbarActionsBarBubbleMac* bubble = CreateAndShowBubble(&delegate); | 291 ToolbarActionsBarBubbleMac* bubble = CreateAndShowBubble(&delegate); |
292 EXPECT_TRUE([bubble actionButton]); | 292 EXPECT_TRUE([bubble actionButton]); |
293 EXPECT_TRUE([bubble iconView]); | 293 EXPECT_TRUE([bubble iconView]); |
294 EXPECT_TRUE([bubble label]); | 294 EXPECT_TRUE([bubble label]); |
295 EXPECT_FALSE([bubble link]); | 295 EXPECT_FALSE([bubble link]); |
(...skipping 23 matching lines...) Expand all Loading... |
319 EXPECT_FALSE([bubble iconView]); | 319 EXPECT_FALSE([bubble iconView]); |
320 EXPECT_FALSE([bubble label]); | 320 EXPECT_FALSE([bubble label]); |
321 EXPECT_TRUE([bubble link]); | 321 EXPECT_TRUE([bubble link]); |
322 EXPECT_TRUE([bubble dismissButton]); | 322 EXPECT_TRUE([bubble dismissButton]); |
323 EXPECT_TRUE([bubble itemList]); | 323 EXPECT_TRUE([bubble itemList]); |
324 | 324 |
325 [bubble close]; | 325 [bubble close]; |
326 chrome::testing::NSRunLoopRunAllPending(); | 326 chrome::testing::NSRunLoopRunAllPending(); |
327 } | 327 } |
328 } | 328 } |
OLD | NEW |