| 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/gdata/operation_registry.h" | 5 #include "chrome/browser/chromeos/gdata/operation_registry.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "content/public/test/test_browser_thread.h" | 10 #include "content/public/test/test_browser_thread.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 using OperationRegistry::Operation::NotifyStart; | 31 using OperationRegistry::Operation::NotifyStart; |
| 32 using OperationRegistry::Operation::NotifyProgress; | 32 using OperationRegistry::Operation::NotifyProgress; |
| 33 using OperationRegistry::Operation::NotifyFinish; | 33 using OperationRegistry::Operation::NotifyFinish; |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 class MockUploadOperation : public MockOperation { | 36 class MockUploadOperation : public MockOperation { |
| 37 public: | 37 public: |
| 38 explicit MockUploadOperation(OperationRegistry* registry) | 38 explicit MockUploadOperation(OperationRegistry* registry) |
| 39 : MockOperation(registry, | 39 : MockOperation(registry, |
| 40 OperationRegistry::OPERATION_UPLOAD, | 40 OperationRegistry::OPERATION_UPLOAD, |
| 41 FilePath("/dummy/upload")) {} | 41 FilePath(FILE_PATH_LITERAL("/dummy/upload"))) {} |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 class MockDownloadOperation : public MockOperation { | 44 class MockDownloadOperation : public MockOperation { |
| 45 public: | 45 public: |
| 46 explicit MockDownloadOperation(OperationRegistry* registry) | 46 explicit MockDownloadOperation(OperationRegistry* registry) |
| 47 : MockOperation(registry, | 47 : MockOperation(registry, |
| 48 OperationRegistry::OPERATION_DOWNLOAD, | 48 OperationRegistry::OPERATION_DOWNLOAD, |
| 49 FilePath("/dummy/download")) {} | 49 FilePath(FILE_PATH_LITERAL("/dummy/download"))) {} |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 class MockOtherOperation : public MockOperation { | 52 class MockOtherOperation : public MockOperation { |
| 53 public: | 53 public: |
| 54 explicit MockOtherOperation(OperationRegistry* registry) | 54 explicit MockOtherOperation(OperationRegistry* registry) |
| 55 : MockOperation(registry, | 55 : MockOperation(registry, |
| 56 OperationRegistry::OPERATION_OTHER, | 56 OperationRegistry::OPERATION_OTHER, |
| 57 FilePath("/dummy/other")) {} | 57 FilePath(FILE_PATH_LITERAL("/dummy/other"))) {} |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 class TestObserver : public OperationRegistry::Observer { | 60 class TestObserver : public OperationRegistry::Observer { |
| 61 public: | 61 public: |
| 62 virtual void OnProgressUpdate( | 62 virtual void OnProgressUpdate( |
| 63 const std::vector<OperationRegistry::ProgressStatus>& list) | 63 const std::vector<OperationRegistry::ProgressStatus>& list) |
| 64 OVERRIDE { | 64 OVERRIDE { |
| 65 status_ = list; | 65 status_ = list; |
| 66 } | 66 } |
| 67 | 67 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 EXPECT_EQ(1U, registry.GetProgressStatusList().size()); | 249 EXPECT_EQ(1U, registry.GetProgressStatusList().size()); |
| 250 op1->NotifyStart(); // restart | 250 op1->NotifyStart(); // restart |
| 251 EXPECT_EQ(1U, registry.GetProgressStatusList().size()); | 251 EXPECT_EQ(1U, registry.GetProgressStatusList().size()); |
| 252 op1->NotifyProgress(0, 200); | 252 op1->NotifyProgress(0, 200); |
| 253 op1->NotifyFinish(OperationRegistry::OPERATION_COMPLETED); | 253 op1->NotifyFinish(OperationRegistry::OPERATION_COMPLETED); |
| 254 EXPECT_EQ(0U, registry.GetProgressStatusList().size()); | 254 EXPECT_EQ(0U, registry.GetProgressStatusList().size()); |
| 255 EXPECT_EQ(NULL, op1.get()); // deleted | 255 EXPECT_EQ(NULL, op1.get()); // deleted |
| 256 } | 256 } |
| 257 | 257 |
| 258 } // namespace gdata | 258 } // namespace gdata |
| OLD | NEW |