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

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

Issue 2416253004: ash: Use session_manager::SessionState (Closed)
Patch Set: add comment about session state in SessionStaetDelegateChromeos Created 4 years, 2 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/common/session/session_state_delegate.h" 5 #include "ash/common/session/session_state_delegate.h"
6 #include "ash/common/wm_shell.h" 6 #include "ash/common/wm_shell.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/chromeos/login/login_manager_test.h" 8 #include "chrome/browser/chromeos/login/login_manager_test.h"
9 #include "chrome/browser/chromeos/login/startup_utils.h" 9 #include "chrome/browser/chromeos/login/startup_utils.h"
10 #include "chrome/browser/profiles/profile_manager.h" 10 #include "chrome/browser/profiles/profile_manager.h"
(...skipping 21 matching lines...) Expand all
32 ~BrowserLoginTest() override {} 32 ~BrowserLoginTest() override {}
33 33
34 void SetUpCommandLine(base::CommandLine* command_line) override { 34 void SetUpCommandLine(base::CommandLine* command_line) override {
35 LoginManagerTest::SetUpCommandLine(command_line); 35 LoginManagerTest::SetUpCommandLine(command_line);
36 command_line->AppendSwitch(::switches::kCreateBrowserOnStartupForTests); 36 command_line->AppendSwitch(::switches::kCreateBrowserOnStartupForTests);
37 } 37 }
38 }; 38 };
39 39
40 IN_PROC_BROWSER_TEST_F(BrowserLoginTest, PRE_BrowserActive) { 40 IN_PROC_BROWSER_TEST_F(BrowserLoginTest, PRE_BrowserActive) {
41 RegisterUser(kTestUser); 41 RegisterUser(kTestUser);
42 EXPECT_EQ(ash::SessionStateDelegate::SESSION_STATE_LOGIN_PRIMARY, 42 EXPECT_EQ(session_manager::SessionState::LOGIN_PRIMARY,
43 ash::WmShell::Get()->GetSessionStateDelegate()->GetSessionState()); 43 ash::WmShell::Get()->GetSessionStateDelegate()->GetSessionState());
44 chromeos::StartupUtils::MarkOobeCompleted(); 44 chromeos::StartupUtils::MarkOobeCompleted();
45 } 45 }
46 46
47 IN_PROC_BROWSER_TEST_F(BrowserLoginTest, BrowserActive) { 47 IN_PROC_BROWSER_TEST_F(BrowserLoginTest, BrowserActive) {
48 EXPECT_EQ(ash::SessionStateDelegate::SESSION_STATE_LOGIN_PRIMARY, 48 EXPECT_EQ(session_manager::SessionState::LOGIN_PRIMARY,
49 ash::WmShell::Get()->GetSessionStateDelegate()->GetSessionState()); 49 ash::WmShell::Get()->GetSessionStateDelegate()->GetSessionState());
50 LoginUser(kTestUser); 50 LoginUser(kTestUser);
51 EXPECT_EQ(ash::SessionStateDelegate::SESSION_STATE_ACTIVE, 51 EXPECT_EQ(session_manager::SessionState::ACTIVE,
52 ash::WmShell::Get()->GetSessionStateDelegate()->GetSessionState()); 52 ash::WmShell::Get()->GetSessionStateDelegate()->GetSessionState());
53 53
54 Browser* browser = 54 Browser* browser =
55 chrome::FindAnyBrowser(ProfileManager::GetActiveUserProfile(), false); 55 chrome::FindAnyBrowser(ProfileManager::GetActiveUserProfile(), false);
56 EXPECT_TRUE(browser != NULL); 56 EXPECT_TRUE(browser != NULL);
57 EXPECT_TRUE(browser->window()->IsActive()); 57 EXPECT_TRUE(browser->window()->IsActive());
58 58
59 gfx::NativeWindow window = browser->window()->GetNativeWindow(); 59 gfx::NativeWindow window = browser->window()->GetNativeWindow();
60 views::Widget* widget = views::Widget::GetWidgetForNativeWindow(window); 60 views::Widget* widget = views::Widget::GetWidgetForNativeWindow(window);
61 views::FocusManager* focus_manager = widget->GetFocusManager(); 61 views::FocusManager* focus_manager = widget->GetFocusManager();
62 EXPECT_TRUE(focus_manager != NULL); 62 EXPECT_TRUE(focus_manager != NULL);
63 63
64 const views::View* focused_view = focus_manager->GetFocusedView(); 64 const views::View* focused_view = focus_manager->GetFocusedView();
65 EXPECT_TRUE(focused_view != NULL); 65 EXPECT_TRUE(focused_view != NULL);
66 EXPECT_EQ(VIEW_ID_OMNIBOX, focused_view->id()); 66 EXPECT_EQ(VIEW_ID_OMNIBOX, focused_view->id());
67 } 67 }
68 68
69 } // namespace chromeos 69 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698