[Metrics] Make MetricsStateManager take a callback param to check if UMA is enabled.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / browser_window_cocoa_browsertest.mm
blob8ec307a2faebbf4788611eb1dbf05ad40fd96a0b
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
3 // found in the LICENSE file.
5 #import <Cocoa/Cocoa.h>
6 #import <objc/runtime.h>
8 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h"
10 #include "base/logging.h"
11 #include "chrome/browser/ui/browser.h"
12 #include "chrome/browser/ui/browser_window.h"
13 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h"
14 #import "chrome/browser/ui/cocoa/info_bubble_window.h"
15 #include "chrome/test/base/in_process_browser_test.h"
16 #include "components/autofill/core/browser/password_generator.h"
17 #include "components/autofill/core/common/password_form.h"
18 #include "ui/gfx/native_widget_types.h"
19 #include "ui/gfx/rect.h"
21 typedef InProcessBrowserTest BrowserWindowCocoaBrowsertest;
23 IN_PROC_BROWSER_TEST_F(BrowserWindowCocoaBrowsertest,
24                        ShowPasswordGenerationBubble) {
25   gfx::Rect rect;
26   autofill::PasswordForm form;
27   autofill::PasswordGenerator generator(10);
28   browser()->window()->ShowPasswordGenerationBubble(rect, form, &generator);
30   // Make sure that the password generation bubble is actually created.
31   NSWindow* window = browser()->window()->GetNativeWindow();
32   BOOL found = NO;
33   for (NSUInteger i = 0; i < [[window childWindows] count]; i++) {
34     id object = [[window childWindows] objectAtIndex:i];
35     if ([object isKindOfClass:[InfoBubbleWindow class]])
36       found = YES;
37   }
38   EXPECT_TRUE(found);