| OLD | NEW |
| 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/drive/drive_scheduler.h" | 5 #include "chrome/browser/chromeos/drive/drive_scheduler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 } | 72 } |
| 73 | 73 |
| 74 // Sets up MockNetworkChangeNotifier as if it's connected to a network with | 74 // Sets up MockNetworkChangeNotifier as if it's connected to a network with |
| 75 // the specified connection type. | 75 // the specified connection type. |
| 76 void ChangeConnectionType(net::NetworkChangeNotifier::ConnectionType type) { | 76 void ChangeConnectionType(net::NetworkChangeNotifier::ConnectionType type) { |
| 77 EXPECT_CALL(*mock_network_change_notifier_, GetCurrentConnectionType()) | 77 EXPECT_CALL(*mock_network_change_notifier_, GetCurrentConnectionType()) |
| 78 .WillRepeatedly(Return(type)); | 78 .WillRepeatedly(Return(type)); |
| 79 // Notify the sync client that the network is changed. This is done via | 79 // Notify the sync client that the network is changed. This is done via |
| 80 // NetworkChangeNotifier in production, but here, we simulate the behavior | 80 // NetworkChangeNotifier in production, but here, we simulate the behavior |
| 81 // by directly calling OnConnectionTypeChanged(). | 81 // by directly calling OnConnectionTypeChanged(). |
| 82 scheduler_->OnConnectionTypeChanged(type); | 82 scheduler_->OnNetworkChanged(type); |
| 83 } | 83 } |
| 84 | 84 |
| 85 // Sets up MockNetworkChangeNotifier as if it's connected to wifi network. | 85 // Sets up MockNetworkChangeNotifier as if it's connected to wifi network. |
| 86 void ConnectToWifi() { | 86 void ConnectToWifi() { |
| 87 ChangeConnectionType(net::NetworkChangeNotifier::CONNECTION_WIFI); | 87 ChangeConnectionType(net::NetworkChangeNotifier::CONNECTION_WIFI); |
| 88 } | 88 } |
| 89 | 89 |
| 90 // Sets up MockNetworkChangeNotifier as if it's connected to cellular network. | 90 // Sets up MockNetworkChangeNotifier as if it's connected to cellular network. |
| 91 void ConnectToCellular() { | 91 void ConnectToCellular() { |
| 92 ChangeConnectionType(net::NetworkChangeNotifier::CONNECTION_2G); | 92 ChangeConnectionType(net::NetworkChangeNotifier::CONNECTION_2G); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 &google_apis::test_util::CopyResultsFromGetResourceEntryCallback, | 280 &google_apis::test_util::CopyResultsFromGetResourceEntryCallback, |
| 281 &error, | 281 &error, |
| 282 &entry)); | 282 &entry)); |
| 283 google_apis::test_util::RunBlockingPoolTask(); | 283 google_apis::test_util::RunBlockingPoolTask(); |
| 284 | 284 |
| 285 ASSERT_EQ(google_apis::HTTP_SUCCESS, error); | 285 ASSERT_EQ(google_apis::HTTP_SUCCESS, error); |
| 286 ASSERT_TRUE(entry); | 286 ASSERT_TRUE(entry); |
| 287 } | 287 } |
| 288 | 288 |
| 289 } // namespace drive | 289 } // namespace drive |
| OLD | NEW |