1 // Copyright 2013 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/chromeos/login/login_manager_test.h"
6 #include "chrome/browser/chromeos/login/startup_utils.h"
7 #include "chrome/browser/profiles/profile_manager.h"
8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_finder.h"
10 #include "chrome/browser/ui/browser_window.h"
11 #include "chrome/browser/ui/view_ids.h"
12 #include "chrome/common/chrome_switches.h"
13 #include "testing/gtest/include/gtest/gtest.h"
14 #include "ui/views/focus/focus_manager.h"
15 #include "ui/views/view.h"
21 const char kTestUser
[] = "test-user@gmail.com";
23 } // anonymous namespace
25 class BrowserLoginTest
: public chromeos::LoginManagerTest
{
27 BrowserLoginTest() : LoginManagerTest(true) {}
28 virtual ~BrowserLoginTest() {}
30 virtual void SetUpCommandLine(CommandLine
* command_line
) OVERRIDE
{
31 LoginManagerTest::SetUpCommandLine(command_line
);
32 command_line
->AppendSwitch(::switches::kCreateBrowserOnStartupForTests
);
36 IN_PROC_BROWSER_TEST_F(BrowserLoginTest
, PRE_BrowserActive
) {
37 RegisterUser(kTestUser
);
38 chromeos::StartupUtils::MarkOobeCompleted();
41 IN_PROC_BROWSER_TEST_F(BrowserLoginTest
, BrowserActive
) {
43 Browser
* browser
= FindAnyBrowser(ProfileManager::GetActiveUserProfile(),
45 chrome::HOST_DESKTOP_TYPE_ASH
);
46 EXPECT_TRUE(browser
!= NULL
);
47 EXPECT_TRUE(browser
->window()->IsActive());
49 views::FocusManager
* focus_manager
= browser
->window()->
50 GetBrowserWindowTesting()->GetTabContentsContainerView()->
52 EXPECT_TRUE(focus_manager
!= NULL
);
54 const views::View
* focused_view
= focus_manager
->GetFocusedView();
55 EXPECT_TRUE(focused_view
!= NULL
);
56 EXPECT_EQ(VIEW_ID_OMNIBOX
, focused_view
->id());
59 } // namespace chromeos