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

Unified Diff: chrome/browser/google_apis/operation_registry_unittest.cc

Issue 10939011: Reland "Revert 156830 - drive: Stop exposing operation_registry() from DriveServiceInterface" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/google_apis/operation_registry.cc ('k') | chrome/browser/google_apis/operations_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/google_apis/operation_registry_unittest.cc
diff --git a/chrome/browser/google_apis/operation_registry_unittest.cc b/chrome/browser/google_apis/operation_registry_unittest.cc
index cb51e3c83552bd6ac8d9a009f4641281e6dc9bf4..56be5a8b114d2fcb16a0527c18c1e29dd956691f 100644
--- a/chrome/browser/google_apis/operation_registry_unittest.cc
+++ b/chrome/browser/google_apis/operation_registry_unittest.cc
@@ -21,7 +21,7 @@ class MockOperation : public OperationRegistry::Operation,
public base::SupportsWeakPtr<MockOperation> {
public:
MockOperation(OperationRegistry* registry,
- OperationRegistry::OperationType type,
+ OperationType type,
const FilePath& path)
: OperationRegistry::Operation(registry, type, path) {}
@@ -37,7 +37,7 @@ class MockUploadOperation : public MockOperation {
public:
explicit MockUploadOperation(OperationRegistry* registry)
: MockOperation(registry,
- OperationRegistry::OPERATION_UPLOAD,
+ OPERATION_UPLOAD,
FilePath(FILE_PATH_LITERAL("/dummy/upload"))) {}
};
@@ -45,7 +45,7 @@ class MockDownloadOperation : public MockOperation {
public:
explicit MockDownloadOperation(OperationRegistry* registry)
: MockOperation(registry,
- OperationRegistry::OPERATION_DOWNLOAD,
+ OPERATION_DOWNLOAD,
FilePath(FILE_PATH_LITERAL("/dummy/download"))) {}
};
@@ -53,36 +53,34 @@ class MockOtherOperation : public MockOperation {
public:
explicit MockOtherOperation(OperationRegistry* registry)
: MockOperation(registry,
- OperationRegistry::OPERATION_OTHER,
+ OPERATION_OTHER,
FilePath(FILE_PATH_LITERAL("/dummy/other"))) {}
};
class TestObserver : public OperationRegistry::Observer {
public:
virtual void OnProgressUpdate(
- const std::vector<OperationRegistry::ProgressStatus>& list)
- OVERRIDE {
+ const OperationProgressStatusList& list) OVERRIDE {
status_ = list;
}
- const std::vector<OperationRegistry::ProgressStatus>& status() const {
+ const OperationProgressStatusList& status() const {
return status_;
}
private:
- std::vector<OperationRegistry::ProgressStatus> status_;
+ OperationProgressStatusList status_;
};
class ProgressMatcher
- : public ::testing::MatcherInterface<
- const OperationRegistry::ProgressStatus&> {
+ : public ::testing::MatcherInterface<const OperationProgressStatus&> {
public:
ProgressMatcher(int64 expected_current, int64 expected_total)
: expected_current_(expected_current),
expected_total_(expected_total) {}
virtual bool MatchAndExplain(
- const OperationRegistry::ProgressStatus& status,
+ const OperationProgressStatus& status,
testing::MatchResultListener* /* listener */) const OVERRIDE {
return status.progress_current == expected_current_ &&
status.progress_total == expected_total_;
@@ -103,16 +101,16 @@ class ProgressMatcher
const int64 expected_total_;
};
-testing::Matcher<const OperationRegistry::ProgressStatus&> Progress(
+testing::Matcher<const OperationProgressStatus&> Progress(
int64 current, int64 total) {
return testing::MakeMatcher(new ProgressMatcher(current, total));
}
} // namespace
-// Pretty-prints ProgressStatus for testing purpose.
+// Pretty-prints OperationProgressStatus for testing purpose.
std::ostream& operator<<(std::ostream& os,
- const OperationRegistry::ProgressStatus& status) {
+ const OperationProgressStatus& status) {
return os << status.DebugString();
}
@@ -142,7 +140,7 @@ TEST_F(OperationRegistryTest, OneSuccess) {
EXPECT_THAT(observer.status(), ElementsAre(Progress(0, 100)));
op1->NotifyProgress(100, 100);
EXPECT_THAT(observer.status(), ElementsAre(Progress(100, 100)));
- op1->NotifyFinish(OperationRegistry::OPERATION_COMPLETED);
+ op1->NotifyFinish(OPERATION_COMPLETED);
// Contains one "COMPLETED" notification.
EXPECT_THAT(observer.status(), ElementsAre(Progress(100, 100)));
// Then it is removed.
@@ -193,11 +191,11 @@ TEST_F(OperationRegistryTest, TwoSuccess) {
op1->NotifyProgress(50, 100);
EXPECT_THAT(observer.status(), ElementsAre(Progress(50, 100),
Progress(0, 200)));
- op1->NotifyFinish(OperationRegistry::OPERATION_COMPLETED);
+ op1->NotifyFinish(OPERATION_COMPLETED);
EXPECT_THAT(observer.status(), ElementsAre(Progress(50, 100),
Progress(0, 200)));
EXPECT_EQ(1U, registry.GetProgressStatusList().size());
- op2->NotifyFinish(OperationRegistry::OPERATION_COMPLETED);
+ op2->NotifyFinish(OPERATION_COMPLETED);
EXPECT_THAT(observer.status(), ElementsAre(Progress(0, 200)));
EXPECT_EQ(0U, registry.GetProgressStatusList().size());
EXPECT_EQ(NULL, op1.get()); // deleted
@@ -250,7 +248,7 @@ TEST_F(OperationRegistryTest, RestartOperation) {
op1->NotifyStart(); // restart
EXPECT_EQ(1U, registry.GetProgressStatusList().size());
op1->NotifyProgress(0, 200);
- op1->NotifyFinish(OperationRegistry::OPERATION_COMPLETED);
+ op1->NotifyFinish(OPERATION_COMPLETED);
EXPECT_EQ(0U, registry.GetProgressStatusList().size());
EXPECT_EQ(NULL, op1.get()); // deleted
}
« no previous file with comments | « chrome/browser/google_apis/operation_registry.cc ('k') | chrome/browser/google_apis/operations_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698