OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "webkit/fileapi/file_system_operation.h" | 5 #include "webkit/fileapi/file_system_operation.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 base::MessageLoopProxy::current(), | 44 base::MessageLoopProxy::current(), |
45 NULL), | 45 NULL), |
46 origin_(origin), | 46 origin_(origin), |
47 type_(type), | 47 type_(type), |
48 usage_(0), | 48 usage_(0), |
49 quota_(kint64max), | 49 quota_(kint64max), |
50 accessed_(0) {} | 50 accessed_(0) {} |
51 | 51 |
52 virtual void GetUsageAndQuota( | 52 virtual void GetUsageAndQuota( |
53 const GURL& origin, quota::StorageType type, | 53 const GURL& origin, quota::StorageType type, |
54 GetUsageAndQuotaCallback* callback) { | 54 GetUsageAndQuotaCallback callback) OVERRIDE { |
awong
2011/09/29 18:05:15
const &.
tzik
2011/10/11 04:53:57
Done.
| |
55 EXPECT_EQ(origin_, origin); | 55 EXPECT_EQ(origin_, origin); |
56 EXPECT_EQ(type_, type); | 56 EXPECT_EQ(type_, type); |
57 callback->Run(quota::kQuotaStatusOk, usage_, quota_); | 57 callback.Run(quota::kQuotaStatusOk, usage_, quota_); |
58 delete callback; | |
59 } | 58 } |
60 | 59 |
61 private: | 60 private: |
62 friend class MockQuotaManagerProxy; | 61 friend class MockQuotaManagerProxy; |
63 void SetQuota(const GURL& origin, StorageType type, int64 quota) { | 62 void SetQuota(const GURL& origin, StorageType type, int64 quota) { |
64 EXPECT_EQ(origin_, origin); | 63 EXPECT_EQ(origin_, origin); |
65 EXPECT_EQ(type_, type); | 64 EXPECT_EQ(type_, type); |
66 quota_ = quota; | 65 quota_ = quota; |
67 } | 66 } |
68 | 67 |
(...skipping 21 matching lines...) Expand all Loading... | |
90 explicit MockQuotaManagerProxy(QuotaManager* quota_manager) | 89 explicit MockQuotaManagerProxy(QuotaManager* quota_manager) |
91 : QuotaManagerProxy(quota_manager, | 90 : QuotaManagerProxy(quota_manager, |
92 base::MessageLoopProxy::current()), | 91 base::MessageLoopProxy::current()), |
93 registered_client_(NULL) { | 92 registered_client_(NULL) { |
94 } | 93 } |
95 | 94 |
96 virtual ~MockQuotaManagerProxy() { | 95 virtual ~MockQuotaManagerProxy() { |
97 EXPECT_FALSE(registered_client_); | 96 EXPECT_FALSE(registered_client_); |
98 } | 97 } |
99 | 98 |
100 virtual void RegisterClient(QuotaClient* client) { | 99 virtual void RegisterClient(QuotaClient* client) OVERRIDE { |
101 EXPECT_FALSE(registered_client_); | 100 EXPECT_FALSE(registered_client_); |
102 registered_client_ = client; | 101 registered_client_ = client; |
103 } | 102 } |
104 | 103 |
105 void SimulateQuotaManagerDestroyed() { | 104 void SimulateQuotaManagerDestroyed() { |
106 if (registered_client_) { | 105 if (registered_client_) { |
107 // We cannot call this in the destructor as the client (indirectly) | 106 // We cannot call this in the destructor as the client (indirectly) |
108 // holds a refptr of the proxy. | 107 // holds a refptr of the proxy. |
109 registered_client_->OnQuotaManagerDestroyed(); | 108 registered_client_->OnQuotaManagerDestroyed(); |
110 registered_client_ = NULL; | 109 registered_client_ = NULL; |
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
980 | 979 |
981 EXPECT_TRUE(file_util::GetFileInfo(platform_path, &info)); | 980 EXPECT_TRUE(file_util::GetFileInfo(platform_path, &info)); |
982 // We compare as time_t here to lower our resolution, to avoid false | 981 // We compare as time_t here to lower our resolution, to avoid false |
983 // negatives caused by conversion to the local filesystem's native | 982 // negatives caused by conversion to the local filesystem's native |
984 // representation and back. | 983 // representation and back. |
985 EXPECT_EQ(new_modified_time.ToTimeT(), info.last_modified.ToTimeT()); | 984 EXPECT_EQ(new_modified_time.ToTimeT(), info.last_modified.ToTimeT()); |
986 EXPECT_EQ(new_accessed_time.ToTimeT(), info.last_accessed.ToTimeT()); | 985 EXPECT_EQ(new_accessed_time.ToTimeT(), info.last_accessed.ToTimeT()); |
987 } | 986 } |
988 | 987 |
989 } // namespace fileapi | 988 } // namespace fileapi |
OLD | NEW |