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

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

Issue 9961014: Add calls to store/retrieve user policy to SessionManagerClient. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comment. Created 8 years, 8 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/login/login_utils.h" 5 #include "chrome/browser/chromeos/login/login_utils.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/scoped_temp_dir.h" 11 #include "base/scoped_temp_dir.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "chrome/browser/chromeos/cros/cros_library.h" 13 #include "chrome/browser/chromeos/cros/cros_library.h"
14 #include "chrome/browser/chromeos/cros/mock_cryptohome_library.h" 14 #include "chrome/browser/chromeos/cros/mock_cryptohome_library.h"
15 #include "chrome/browser/chromeos/cros/mock_library_loader.h" 15 #include "chrome/browser/chromeos/cros/mock_library_loader.h"
16 #include "chrome/browser/chromeos/cryptohome/mock_async_method_caller.h" 16 #include "chrome/browser/chromeos/cryptohome/mock_async_method_caller.h"
17 #include "chrome/browser/chromeos/dbus/mock_dbus_thread_manager.h" 17 #include "chrome/browser/chromeos/dbus/mock_dbus_thread_manager.h"
18 #include "chrome/browser/chromeos/dbus/mock_session_manager_client.h" 18 #include "chrome/browser/chromeos/dbus/mock_session_manager_client.h"
19 #include "chrome/browser/chromeos/login/authenticator.h" 19 #include "chrome/browser/chromeos/login/authenticator.h"
20 #include "chrome/browser/chromeos/login/login_status_consumer.h" 20 #include "chrome/browser/chromeos/login/login_status_consumer.h"
21 #include "chrome/browser/chromeos/login/user_manager.h" 21 #include "chrome/browser/chromeos/login/user_manager.h"
22 #include "chrome/browser/io_thread.h" 22 #include "chrome/browser/io_thread.h"
23 #include "chrome/browser/net/predictor.h" 23 #include "chrome/browser/net/predictor.h"
24 #include "chrome/browser/policy/browser_policy_connector.h" 24 #include "chrome/browser/policy/browser_policy_connector.h"
25 #include "chrome/browser/policy/cloud_policy_data_store.h" 25 #include "chrome/browser/policy/cloud_policy_data_store.h"
26 #include "chrome/browser/policy/proto/device_management_backend.pb.h" 26 #include "chrome/browser/policy/proto/device_management_backend.pb.h"
27 #include "chrome/browser/profiles/profile_manager.h" 27 #include "chrome/browser/profiles/profile_manager.h"
28 #include "chrome/common/chrome_paths.h" 28 #include "chrome/common/chrome_paths.h"
29 #include "chrome/common/chrome_switches.h" 29 #include "chrome/common/chrome_switches.h"
30 #include "chrome/common/net/gaia/gaia_auth_consumer.h"
30 #include "chrome/common/net/gaia/gaia_urls.h" 31 #include "chrome/common/net/gaia/gaia_urls.h"
31 #include "chrome/common/pref_names.h" 32 #include "chrome/common/pref_names.h"
32 #include "chrome/common/net/gaia/gaia_auth_consumer.h"
33 #include "chrome/test/base/testing_browser_process.h" 33 #include "chrome/test/base/testing_browser_process.h"
34 #include "chrome/test/base/testing_pref_service.h" 34 #include "chrome/test/base/testing_pref_service.h"
35 #include "content/public/browser/browser_thread.h" 35 #include "content/public/browser/browser_thread.h"
36 #include "content/public/common/url_fetcher_delegate.h" 36 #include "content/public/common/url_fetcher_delegate.h"
37 #include "content/test/test_browser_thread.h" 37 #include "content/test/test_browser_thread.h"
38 #include "content/test/test_url_fetcher_factory.h" 38 #include "content/test/test_url_fetcher_factory.h"
39 #include "net/url_request/url_request.h" 39 #include "net/url_request/url_request.h"
40 #include "net/url_request/url_request_status.h" 40 #include "net/url_request/url_request_status.h"
41 #include "testing/gmock/include/gmock/gmock.h" 41 #include "testing/gmock/include/gmock/gmock.h"
42 #include "testing/gtest/include/gtest/gtest.h" 42 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 124
125 // DBusThreadManager should be initialized before io_thread_state_, as 125 // DBusThreadManager should be initialized before io_thread_state_, as
126 // DBusThreadManager is used from chromeos::ProxyConfigServiceImpl, 126 // DBusThreadManager is used from chromeos::ProxyConfigServiceImpl,
127 // which is part of io_thread_state_. 127 // which is part of io_thread_state_.
128 DBusThreadManager::InitializeForTesting(&mock_dbus_thread_manager_); 128 DBusThreadManager::InitializeForTesting(&mock_dbus_thread_manager_);
129 129
130 // Likewise, SessionManagerClient should also be initialized before 130 // Likewise, SessionManagerClient should also be initialized before
131 // io_thread_state_. 131 // io_thread_state_.
132 MockSessionManagerClient* session_managed_client = 132 MockSessionManagerClient* session_managed_client =
133 mock_dbus_thread_manager_.mock_session_manager_client(); 133 mock_dbus_thread_manager_.mock_session_manager_client();
134 EXPECT_CALL(*session_managed_client, RetrievePolicy(_)) 134 EXPECT_CALL(*session_managed_client, RetrieveDevicePolicy(_))
135 .WillRepeatedly(MockSessionManagerClientPolicyCallback("")); 135 .WillRepeatedly(MockSessionManagerClientPolicyCallback(""));
136 136
137 mock_async_method_caller_ = new cryptohome::MockAsyncMethodCaller; 137 mock_async_method_caller_ = new cryptohome::MockAsyncMethodCaller;
138 cryptohome::AsyncMethodCaller::InitializeForTesting( 138 cryptohome::AsyncMethodCaller::InitializeForTesting(
139 mock_async_method_caller_); 139 mock_async_method_caller_);
140 140
141 io_thread_state_.reset(new IOThread(local_state_.Get(), NULL, NULL)); 141 io_thread_state_.reset(new IOThread(local_state_.Get(), NULL, NULL));
142 browser_process_->SetIOThread(io_thread_state_.get()); 142 browser_process_->SetIOThread(io_thread_state_.get());
143 143
144 CrosLibrary::TestApi* test_api = CrosLibrary::Get()->GetTestApi(); 144 CrosLibrary::TestApi* test_api = CrosLibrary::Get()->GetTestApi();
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 } 504 }
505 505
506 INSTANTIATE_TEST_CASE_P( 506 INSTANTIATE_TEST_CASE_P(
507 LoginUtilsBlockingLoginTestInstance, 507 LoginUtilsBlockingLoginTestInstance,
508 LoginUtilsBlockingLoginTest, 508 LoginUtilsBlockingLoginTest,
509 testing::Values(0, 1, 2, 3, 4, 5)); 509 testing::Values(0, 1, 2, 3, 4, 5));
510 510
511 } // namespace 511 } // namespace
512 512
513 } 513 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698