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

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

Issue 8773016: chromeos: remove power manager EXPECTs from login_browsertest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed expectations Created 9 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/time.h" 6 #include "base/time.h"
7 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" 7 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h"
8 #include "chrome/browser/chromeos/cros/mock_cryptohome_library.h" 8 #include "chrome/browser/chromeos/cros/mock_cryptohome_library.h"
9 #include "chrome/browser/chromeos/cros/mock_library_loader.h" 9 #include "chrome/browser/chromeos/cros/mock_library_loader.h"
10 #include "chrome/browser/chromeos/cros/mock_network_library.h" 10 #include "chrome/browser/chromeos/cros/mock_network_library.h"
11 #include "chrome/browser/chromeos/dbus/mock_power_manager_client.h"
12 #include "chrome/browser/profiles/profile_manager.h" 11 #include "chrome/browser/profiles/profile_manager.h"
13 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
14 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
15 #include "chrome/test/base/in_process_browser_test.h" 14 #include "chrome/test/base/in_process_browser_test.h"
16 #include "chrome/test/base/ui_test_utils.h" 15 #include "chrome/test/base/ui_test_utils.h"
17 #include "testing/gmock/include/gmock/gmock.h" 16 #include "testing/gmock/include/gmock/gmock.h"
18 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
19 18
20 namespace chromeos { 19 namespace chromeos {
21 using ::testing::_; 20 using ::testing::_;
22 using ::testing::AtLeast; 21 using ::testing::AtLeast;
23 using ::testing::Return; 22 using ::testing::Return;
24 23
25 class LoginTestBase : public CrosInProcessBrowserTest { 24 class LoginTestBase : public CrosInProcessBrowserTest {
26 public: 25 public:
27 LoginTestBase() : mock_cryptohome_library_(NULL) { 26 LoginTestBase() : mock_cryptohome_library_(NULL) {
28 } 27 }
29 28
30 protected: 29 protected:
31 virtual void SetUpInProcessBrowserTestFixture() { 30 virtual void SetUpInProcessBrowserTestFixture() {
32 cros_mock_->InitStatusAreaMocks(); 31 cros_mock_->InitStatusAreaMocks();
33 cros_mock_->SetStatusAreaMocksExpectations(); 32 cros_mock_->SetStatusAreaMocksExpectations();
34 cros_mock_->InitMockCryptohomeLibrary(); 33 cros_mock_->InitMockCryptohomeLibrary();
35 mock_cryptohome_library_ = cros_mock_->mock_cryptohome_library(); 34 mock_cryptohome_library_ = cros_mock_->mock_cryptohome_library();
36 EXPECT_CALL(*mock_cryptohome_library_, IsMounted()) 35 EXPECT_CALL(*mock_cryptohome_library_, IsMounted())
37 .WillRepeatedly(Return(true)); 36 .WillRepeatedly(Return(true));
38 } 37 }
39 38
40 MockCryptohomeLibrary* mock_cryptohome_library_; 39 MockCryptohomeLibrary* mock_cryptohome_library_;
41 MockPowerManagerClient mock_power_manager_client_;
42 40
43 private: 41 private:
44 DISALLOW_COPY_AND_ASSIGN(LoginTestBase); 42 DISALLOW_COPY_AND_ASSIGN(LoginTestBase);
45 }; 43 };
46 44
47 class LoginUserTest : public LoginTestBase { 45 class LoginUserTest : public LoginTestBase {
48 protected: 46 protected:
49 virtual void SetUpInProcessBrowserTestFixture() { 47 virtual void SetUpInProcessBrowserTestFixture() {
50 LoginTestBase::SetUpInProcessBrowserTestFixture(); 48 LoginTestBase::SetUpInProcessBrowserTestFixture();
51 EXPECT_CALL(mock_power_manager_client_, AddObserver(_))
52 .Times(AtLeast(1))
53 .WillRepeatedly(Return());
54 EXPECT_CALL(mock_power_manager_client_, RemoveObserver(_))
55 .Times(AtLeast(1))
56 .WillRepeatedly(Return());
57 } 49 }
58 50
59 virtual void SetUpCommandLine(CommandLine* command_line) { 51 virtual void SetUpCommandLine(CommandLine* command_line) {
60 command_line->AppendSwitchASCII(switches::kLoginUser, "TestUser@gmail.com"); 52 command_line->AppendSwitchASCII(switches::kLoginUser, "TestUser@gmail.com");
61 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); 53 command_line->AppendSwitchASCII(switches::kLoginProfile, "user");
62 command_line->AppendSwitch(switches::kNoFirstRun); 54 command_line->AppendSwitch(switches::kNoFirstRun);
63 } 55 }
64 }; 56 };
65 57
66 class LoginProfileTest : public LoginUserTest { 58 class LoginProfileTest : public LoginUserTest {
(...skipping 16 matching lines...) Expand all
83 // On initial launch, we should get the OTR default profile. 75 // On initial launch, we should get the OTR default profile.
84 IN_PROC_BROWSER_TEST_F(LoginProfileTest, UserNotPassed) { 76 IN_PROC_BROWSER_TEST_F(LoginProfileTest, UserNotPassed) {
85 Profile* profile = browser()->profile(); 77 Profile* profile = browser()->profile();
86 EXPECT_EQ("Default", profile->GetPath().BaseName().value()); 78 EXPECT_EQ("Default", profile->GetPath().BaseName().value());
87 EXPECT_TRUE(profile->IsOffTheRecord()); 79 EXPECT_TRUE(profile->IsOffTheRecord());
88 // Ensure there's extension service for this profile. 80 // Ensure there's extension service for this profile.
89 EXPECT_TRUE(profile->GetExtensionService()); 81 EXPECT_TRUE(profile->GetExtensionService());
90 } 82 }
91 83
92 } // namespace chromeos 84 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698