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

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: . 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 virtual ~BrowserLoginTest() {}
29
30 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
31 LoginManagerTest::SetUpCommandLine(command_line);
32 command_line->AppendSwitch(::switches::kCreateBrowserOnStartupForTests);
33 }
34 };
35
36 IN_PROC_BROWSER_TEST_F(BrowserLoginTest, PRE_BrowserActive) {
37 RegisterUser(kTestUser);
38 chromeos::StartupUtils::MarkOobeCompleted();
39 }
40
41 IN_PROC_BROWSER_TEST_F(BrowserLoginTest, BrowserActive) {
42 LoginUser(kTestUser);
43 Browser* browser = FindAnyBrowser(ProfileManager::GetDefaultProfile(),
44 false,
45 chrome::HOST_DESKTOP_TYPE_ASH);
46 EXPECT_TRUE(browser != NULL);
47 EXPECT_TRUE(browser->window()->IsActive());
48
49 views::FocusManager* focus_manager = browser->window()->
50 GetBrowserWindowTesting()->GetTabContentsContainerView()->
51 GetFocusManager();
52 EXPECT_TRUE(focus_manager != NULL);
53
54 const views::View* focused_view = focus_manager->GetFocusedView();
55 EXPECT_TRUE(focused_view != NULL);
56 EXPECT_EQ(VIEW_ID_OMNIBOX, focused_view->id());
57 }
58
59 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698