[Metrics] Make MetricsStateManager take a callback param to check if UMA is enabled.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / profiles / user_manager_mac_unittest.mm
blobaab68ea55ceea6089350425a7a48ab959d9fe012
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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/cocoa/profiles/user_manager_mac.h"
7 #include "base/run_loop.h"
8 #include "chrome/browser/profiles/profile_window.h"
9 #include "chrome/test/base/browser_with_test_window_test.h"
10 #include "chrome/test/base/testing_browser_process.h"
11 #include "chrome/test/base/testing_profile_manager.h"
13 class UserManagerMacTest : public BrowserWithTestWindowTest {
14  public:
15   UserManagerMacTest()
16       : testing_profile_manager_(TestingBrowserProcess::GetGlobal()) {
17   }
19   virtual void SetUp() OVERRIDE {
20     BrowserWithTestWindowTest::SetUp();
21     ASSERT_TRUE(testing_profile_manager_.SetUp());
22     // Pre-load the guest profile so we don't have to wait for the User Manager
23     // to asynchronously create it.
24     testing_profile_manager_.CreateGuestProfile();
25   }
27   virtual void TearDown() OVERRIDE {
28     testing_profile_manager_.DeleteGuestProfile();
29     TestingBrowserProcess::GetGlobal()->SetProfileManager(NULL);
30     base::RunLoop().RunUntilIdle();
31     BrowserWithTestWindowTest::TearDown();
32   }
34  private:
35   TestingProfileManager testing_profile_manager_;
37   DISALLOW_COPY_AND_ASSIGN(UserManagerMacTest);
40 TEST_F(UserManagerMacTest, ShowUserManager) {
41   EXPECT_FALSE(UserManagerMac::IsShowing());
42   UserManagerMac::Show(base::FilePath(), profiles::USER_MANAGER_NO_TUTORIAL);
43   EXPECT_TRUE(UserManagerMac::IsShowing());
45   UserManagerMac::Hide();
46   EXPECT_FALSE(UserManagerMac::IsShowing());