OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 #import <objc/runtime.h> | 6 #import <objc/runtime.h> |
7 | 7 |
8 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h" | 8 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/browser_window.h" | 12 #include "chrome/browser/ui/browser_window.h" |
13 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" | 13 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
14 #import "chrome/browser/ui/cocoa/info_bubble_window.h" | 14 #import "chrome/browser/ui/cocoa/info_bubble_window.h" |
15 #include "chrome/test/base/in_process_browser_test.h" | 15 #include "chrome/test/base/in_process_browser_test.h" |
16 #include "components/autofill/browser/password_generator.h" | 16 #include "components/autofill/core/browser/password_generator.h" |
17 #include "content/public/common/password_form.h" | 17 #include "content/public/common/password_form.h" |
18 #include "ui/gfx/native_widget_types.h" | 18 #include "ui/gfx/native_widget_types.h" |
19 #include "ui/gfx/rect.h" | 19 #include "ui/gfx/rect.h" |
20 | 20 |
21 typedef InProcessBrowserTest BrowserWindowCocoaBrowsertest; | 21 typedef InProcessBrowserTest BrowserWindowCocoaBrowsertest; |
22 | 22 |
23 IN_PROC_BROWSER_TEST_F(BrowserWindowCocoaBrowsertest, | 23 IN_PROC_BROWSER_TEST_F(BrowserWindowCocoaBrowsertest, |
24 ShowPasswordGenerationBubble) { | 24 ShowPasswordGenerationBubble) { |
25 gfx::Rect rect; | 25 gfx::Rect rect; |
26 content::PasswordForm form; | 26 content::PasswordForm form; |
27 autofill::PasswordGenerator generator(10); | 27 autofill::PasswordGenerator generator(10); |
28 browser()->window()->ShowPasswordGenerationBubble(rect, form, &generator); | 28 browser()->window()->ShowPasswordGenerationBubble(rect, form, &generator); |
29 | 29 |
30 // Make sure that the password generation bubble is actually created. | 30 // Make sure that the password generation bubble is actually created. |
31 NSWindow* window = browser()->window()->GetNativeWindow(); | 31 NSWindow* window = browser()->window()->GetNativeWindow(); |
32 BOOL found = NO; | 32 BOOL found = NO; |
33 for (NSUInteger i = 0; i < [[window childWindows] count]; i++) { | 33 for (NSUInteger i = 0; i < [[window childWindows] count]; i++) { |
34 id object = [[window childWindows] objectAtIndex:i]; | 34 id object = [[window childWindows] objectAtIndex:i]; |
35 if ([object isKindOfClass:[InfoBubbleWindow class]]) | 35 if ([object isKindOfClass:[InfoBubbleWindow class]]) |
36 found = YES; | 36 found = YES; |
37 } | 37 } |
38 EXPECT_TRUE(found); | 38 EXPECT_TRUE(found); |
39 } | 39 } |
OLD | NEW |