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/job_scheduler.h" | 5 #include "chrome/browser/chromeos/drive/job_scheduler.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 "gdata/account_metadata.json"); | 102 "gdata/account_metadata.json"); |
103 fake_drive_service_->LoadAppListForDriveApi( | 103 fake_drive_service_->LoadAppListForDriveApi( |
104 "drive/applist.json"); | 104 "drive/applist.json"); |
105 | 105 |
106 scheduler_.reset(new JobScheduler(profile_.get(), | 106 scheduler_.reset(new JobScheduler(profile_.get(), |
107 fake_drive_service_.get(), | 107 fake_drive_service_.get(), |
108 base::MessageLoopProxy::current())); | 108 base::MessageLoopProxy::current())); |
109 scheduler_->SetDisableThrottling(true); | 109 scheduler_->SetDisableThrottling(true); |
110 } | 110 } |
111 | 111 |
112 virtual void TearDown() OVERRIDE { | |
113 // The scheduler should be deleted before NetworkLibrary, as it | |
114 // registers itself as observer of NetworkLibrary. | |
115 scheduler_.reset(); | |
116 base::RunLoop().RunUntilIdle(); | |
117 fake_drive_service_.reset(); | |
118 fake_network_change_notifier_.reset(); | |
119 } | |
120 | |
121 protected: | 112 protected: |
122 // Sets up FakeNetworkChangeNotifier as if it's connected to a network with | 113 // Sets up FakeNetworkChangeNotifier as if it's connected to a network with |
123 // the specified connection type. | 114 // the specified connection type. |
124 void ChangeConnectionType(net::NetworkChangeNotifier::ConnectionType type) { | 115 void ChangeConnectionType(net::NetworkChangeNotifier::ConnectionType type) { |
125 fake_network_change_notifier_->SetConnectionType(type); | 116 fake_network_change_notifier_->SetConnectionType(type); |
126 } | 117 } |
127 | 118 |
128 // Sets up FakeNetworkChangeNotifier as if it's connected to wifi network. | 119 // Sets up FakeNetworkChangeNotifier as if it's connected to wifi network. |
129 void ConnectToWifi() { | 120 void ConnectToWifi() { |
130 ChangeConnectionType(net::NetworkChangeNotifier::CONNECTION_WIFI); | 121 ChangeConnectionType(net::NetworkChangeNotifier::CONNECTION_WIFI); |
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 | 862 |
872 std::vector<int64> upload_progress; | 863 std::vector<int64> upload_progress; |
873 logger.GetProgressInfo(TYPE_UPLOAD_NEW_FILE, &upload_progress); | 864 logger.GetProgressInfo(TYPE_UPLOAD_NEW_FILE, &upload_progress); |
874 ASSERT_TRUE(!upload_progress.empty()); | 865 ASSERT_TRUE(!upload_progress.empty()); |
875 EXPECT_TRUE(base::STLIsSorted(upload_progress)); | 866 EXPECT_TRUE(base::STLIsSorted(upload_progress)); |
876 EXPECT_GE(upload_progress.front(), 0); | 867 EXPECT_GE(upload_progress.front(), 0); |
877 EXPECT_LE(upload_progress.back(), 13); | 868 EXPECT_LE(upload_progress.back(), 13); |
878 } | 869 } |
879 | 870 |
880 } // namespace drive | 871 } // namespace drive |
OLD | NEW |