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

Side by Side Diff: chrome/browser/chromeos/cros/cros_mock.cc

Issue 8934019: chromeos: Remove ScreenLockLibrary. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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
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 "chrome/browser/chromeos/cros/cros_mock.h" 5 #include "chrome/browser/chromeos/cros/cros_mock.h"
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "chrome/browser/chromeos/cros/mock_cryptohome_library.h" 10 #include "chrome/browser/chromeos/cros/mock_cryptohome_library.h"
11 #include "chrome/browser/chromeos/cros/mock_library_loader.h" 11 #include "chrome/browser/chromeos/cros/mock_library_loader.h"
12 #include "chrome/browser/chromeos/cros/mock_network_library.h" 12 #include "chrome/browser/chromeos/cros/mock_network_library.h"
13 #include "chrome/browser/chromeos/cros/mock_screen_lock_library.h"
14 #include "chrome/browser/chromeos/login/wizard_controller.h" 13 #include "chrome/browser/chromeos/login/wizard_controller.h"
15 #include "chrome/browser/chromeos/login/wizard_screen.h" 14 #include "chrome/browser/chromeos/login/wizard_screen.h"
16 #include "chrome/test/base/in_process_browser_test.h" 15 #include "chrome/test/base/in_process_browser_test.h"
17 #include "chrome/test/base/ui_test_utils.h" 16 #include "chrome/test/base/ui_test_utils.h"
18 #include "testing/gmock/include/gmock/gmock.h" 17 #include "testing/gmock/include/gmock/gmock.h"
19 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
20 19
21 namespace chromeos { 20 namespace chromeos {
22 21
23 using ::testing::AnyNumber; 22 using ::testing::AnyNumber;
24 using ::testing::AtMost; 23 using ::testing::AtMost;
25 using ::testing::InSequence; 24 using ::testing::InSequence;
26 using ::testing::InvokeWithoutArgs; 25 using ::testing::InvokeWithoutArgs;
27 using ::testing::Return; 26 using ::testing::Return;
28 using ::testing::ReturnRef; 27 using ::testing::ReturnRef;
29 using ::testing::StrictMock; 28 using ::testing::StrictMock;
30 using ::testing::_; 29 using ::testing::_;
31 30
32 CrosMock::CrosMock() 31 CrosMock::CrosMock()
33 : loader_(NULL), 32 : loader_(NULL),
34 mock_cryptohome_library_(NULL), 33 mock_cryptohome_library_(NULL),
35 mock_network_library_(NULL), 34 mock_network_library_(NULL) {
36 mock_screen_lock_library_(NULL) {
37 } 35 }
38 36
39 CrosMock::~CrosMock() { 37 CrosMock::~CrosMock() {
40 } 38 }
41 39
42 chromeos::CrosLibrary::TestApi* CrosMock::test_api() { 40 chromeos::CrosLibrary::TestApi* CrosMock::test_api() {
43 return chromeos::CrosLibrary::Get()->GetTestApi(); 41 return chromeos::CrosLibrary::Get()->GetTestApi();
44 } 42 }
45 43
46 void CrosMock::InitStatusAreaMocks() { 44 void CrosMock::InitStatusAreaMocks() {
(...skipping 19 matching lines...) Expand all
66 } 64 }
67 65
68 void CrosMock::InitMockNetworkLibrary() { 66 void CrosMock::InitMockNetworkLibrary() {
69 InitMockLibraryLoader(); 67 InitMockLibraryLoader();
70 if (mock_network_library_) 68 if (mock_network_library_)
71 return; 69 return;
72 mock_network_library_ = new StrictMock<MockNetworkLibrary>(); 70 mock_network_library_ = new StrictMock<MockNetworkLibrary>();
73 test_api()->SetNetworkLibrary(mock_network_library_, true); 71 test_api()->SetNetworkLibrary(mock_network_library_, true);
74 } 72 }
75 73
76 void CrosMock::InitMockScreenLockLibrary() {
77 InitMockLibraryLoader();
78 if (mock_screen_lock_library_)
79 return;
80 mock_screen_lock_library_ = new StrictMock<MockScreenLockLibrary>();
81 test_api()->SetScreenLockLibrary(mock_screen_lock_library_, true);
82 }
83
84 // Initialization of mocks. 74 // Initialization of mocks.
85 MockCryptohomeLibrary* CrosMock::mock_cryptohome_library() { 75 MockCryptohomeLibrary* CrosMock::mock_cryptohome_library() {
86 return mock_cryptohome_library_; 76 return mock_cryptohome_library_;
87 } 77 }
88 78
89 MockNetworkLibrary* CrosMock::mock_network_library() { 79 MockNetworkLibrary* CrosMock::mock_network_library() {
90 return mock_network_library_; 80 return mock_network_library_;
91 } 81 }
92 82
93 MockScreenLockLibrary* CrosMock::mock_screen_lock_library() {
94 return mock_screen_lock_library_;
95 }
96
97 void CrosMock::SetStatusAreaMocksExpectations() { 83 void CrosMock::SetStatusAreaMocksExpectations() {
98 SetNetworkLibraryStatusAreaExpectations(); 84 SetNetworkLibraryStatusAreaExpectations();
99 } 85 }
100 86
101 void CrosMock::SetNetworkLibraryStatusAreaExpectations() { 87 void CrosMock::SetNetworkLibraryStatusAreaExpectations() {
102 // We don't care how often these are called, just set their return values: 88 // We don't care how often these are called, just set their return values:
103 EXPECT_CALL(*mock_network_library_, AddNetworkManagerObserver(_)) 89 EXPECT_CALL(*mock_network_library_, AddNetworkManagerObserver(_))
104 .Times(AnyNumber()); 90 .Times(AnyNumber());
105 EXPECT_CALL(*mock_network_library_, AddNetworkDeviceObserver(_, _)) 91 EXPECT_CALL(*mock_network_library_, AddNetworkDeviceObserver(_, _))
106 .Times(AnyNumber()); 92 .Times(AnyNumber());
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 } 190 }
205 191
206 void CrosMock::TearDownMocks() { 192 void CrosMock::TearDownMocks() {
207 // Prevent bogus gMock leak check from firing. 193 // Prevent bogus gMock leak check from firing.
208 if (loader_) 194 if (loader_)
209 test_api()->SetLibraryLoader(NULL, false); 195 test_api()->SetLibraryLoader(NULL, false);
210 if (mock_cryptohome_library_) 196 if (mock_cryptohome_library_)
211 test_api()->SetCryptohomeLibrary(NULL, false); 197 test_api()->SetCryptohomeLibrary(NULL, false);
212 if (mock_network_library_) 198 if (mock_network_library_)
213 test_api()->SetNetworkLibrary(NULL, false); 199 test_api()->SetNetworkLibrary(NULL, false);
214 if (mock_screen_lock_library_)
215 test_api()->SetScreenLockLibrary(NULL, false);
216 } 200 }
217 201
218 } // namespace chromeos 202 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros/cros_mock.h ('k') | chrome/browser/chromeos/cros/mock_screen_lock_library.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698