Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(820)

Side by Side Diff: chrome/browser/chromeos/login/session_login_browsertest.cc

Issue 22887021: Pass focus to browser after login. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: +test Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
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"
16
17 namespace chromeos {
18
19 namespace {
20
21 const char kTestUser[] = "test-user@gmail.com";
22
23 } // anonymous namespace
24
25 class BrowserLoginTest : public chromeos::LoginManagerTest {
26 public:
27 BrowserLoginTest() : LoginManagerTest(true) {}
28
29 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
30 LoginManagerTest::SetUpCommandLine(command_line);
31 command_line->AppendSwitch(::switches::kCreateBrowserOnStartupForTests);
32 }
33 };
34
35 IN_PROC_BROWSER_TEST_F(BrowserLoginTest, PRE_BrowserActive) {
36 RegisterUser(kTestUser);
37 chromeos::StartupUtils::MarkOobeCompleted();
38 }
39
40 IN_PROC_BROWSER_TEST_F(BrowserLoginTest, BrowserActive) {
41 LoginUser(kTestUser);
42 Browser* browser = FindAnyBrowser(ProfileManager::GetDefaultProfile(),
43 false,
44 chrome::HOST_DESKTOP_TYPE_ASH);
45 EXPECT_TRUE(browser != NULL);
46 EXPECT_TRUE(browser->window()->IsActive());
47
48 views::FocusManager* focus_manager = browser->window()->
49 GetBrowserWindowTesting()->GetTabContentsContainerView()->
50 GetFocusManager();
51 EXPECT_TRUE(focus_manager != NULL);
52
53 const views::View* focused_view = focus_manager->GetFocusedView();
54 EXPECT_TRUE(focused_view != NULL);
55 EXPECT_EQ(VIEW_ID_OMNIBOX, focused_view->id());
56 }
57
58 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698