[Metrics] Make MetricsStateManager take a callback param to check if UMA is enabled.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / content_settings / collected_cookies_mac_browsertest.mm
blob1be581bdf06afc99febacc3e77a31eff05528bf0
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 "chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h"
7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/browser/ui/tabs/tab_strip_model.h"
9 #include "chrome/test/base/in_process_browser_test.h"
10 #include "components/web_modal/web_contents_modal_dialog_manager.h"
11 #include "content/public/test/test_utils.h"
13 using web_modal::WebContentsModalDialogManager;
15 typedef InProcessBrowserTest CollectedCookiesMacTest;
17 IN_PROC_BROWSER_TEST_F(CollectedCookiesMacTest, Close) {
18   content::WebContents* web_contents =
19       browser()->tab_strip_model()->GetActiveWebContents();
20   WebContentsModalDialogManager* web_contents_modal_dialog_manager =
21       WebContentsModalDialogManager::FromWebContents(web_contents);
22   EXPECT_FALSE(web_contents_modal_dialog_manager->IsDialogActive());
24   // Deletes itself.
25   CollectedCookiesMac* dialog = new CollectedCookiesMac(
26       browser()->tab_strip_model()->GetActiveWebContents());
27   EXPECT_TRUE(web_contents_modal_dialog_manager->IsDialogActive());
29   dialog->PerformClose();
30   content::RunAllPendingInMessageLoop();
31   EXPECT_FALSE(web_contents_modal_dialog_manager->IsDialogActive());
34 IN_PROC_BROWSER_TEST_F(CollectedCookiesMacTest, Outlets) {
35   // Deletes itself.
36   CollectedCookiesMac* dialog = new CollectedCookiesMac(
37       browser()->tab_strip_model()->GetActiveWebContents());
38   CollectedCookiesWindowController* sheet_controller =
39       dialog->sheet_controller();
41   EXPECT_TRUE([sheet_controller allowedTreeController]);
42   EXPECT_TRUE([sheet_controller blockedTreeController]);
43   EXPECT_TRUE([sheet_controller allowedOutlineView]);
44   EXPECT_TRUE([sheet_controller blockedOutlineView]);
45   EXPECT_TRUE([sheet_controller infoBar]);
46   EXPECT_TRUE([sheet_controller infoBarIcon]);
47   EXPECT_TRUE([sheet_controller infoBarText]);
48   EXPECT_TRUE([sheet_controller tabView]);
49   EXPECT_TRUE([sheet_controller blockedScrollView]);
50   EXPECT_TRUE([sheet_controller blockedCookiesText]);
51   EXPECT_TRUE([sheet_controller cookieDetailsViewPlaceholder]);
53   [sheet_controller closeSheet:nil];
54   content::RunAllPendingInMessageLoop();