OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "apps/saved_files_service.h" | 7 #include "apps/saved_files_service.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/test/values_test_util.h" | 10 #include "base/test/values_test_util.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "chrome/browser/extensions/test_extension_environment.h" | 12 #include "chrome/browser/extensions/test_extension_environment.h" |
13 #include "chrome/test/base/testing_profile.h" | 13 #include "chrome/test/base/testing_profile.h" |
| 14 #include "extensions/browser/api/file_system/saved_file_entry.h" |
14 #include "extensions/browser/extension_prefs.h" | 15 #include "extensions/browser/extension_prefs.h" |
15 #include "extensions/browser/extension_system.h" | 16 #include "extensions/browser/extension_system.h" |
16 #include "extensions/common/extension.h" | 17 #include "extensions/common/extension.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
18 | 19 |
19 #define TRACE_CALL(expression) \ | 20 #define TRACE_CALL(expression) \ |
20 do { \ | 21 do { \ |
21 SCOPED_TRACE(#expression); \ | 22 SCOPED_TRACE(#expression); \ |
22 expression; \ | 23 expression; \ |
23 } while (0) | 24 } while (0) |
24 | 25 |
25 using apps::SavedFileEntry; | |
26 using apps::SavedFilesService; | 26 using apps::SavedFilesService; |
| 27 using extensions::SavedFileEntry; |
27 | 28 |
28 namespace { | 29 namespace { |
29 | 30 |
30 std::string GenerateId(int i) { | 31 std::string GenerateId(int i) { |
31 return base::IntToString(i) + ":filename.ext"; | 32 return base::IntToString(i) + ":filename.ext"; |
32 } | 33 } |
33 | 34 |
34 } // namespace | 35 } // namespace |
35 | 36 |
36 class SavedFilesServiceUnitTest : public testing::Test { | 37 class SavedFilesServiceUnitTest : public testing::Test { |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 TRACE_CALL(CheckEntrySequenceNumber(3, 6)); | 227 TRACE_CALL(CheckEntrySequenceNumber(3, 6)); |
227 | 228 |
228 // This should push the sequence number to the limit of 8, and trigger a | 229 // This should push the sequence number to the limit of 8, and trigger a |
229 // sequence number compaction. Expect that the sequence numbers are | 230 // sequence number compaction. Expect that the sequence numbers are |
230 // contiguous from 1 to 4. | 231 // contiguous from 1 to 4. |
231 service_->EnqueueFileEntry(extension_->id(), GenerateId(3)); | 232 service_->EnqueueFileEntry(extension_->id(), GenerateId(3)); |
232 TRACE_CALL(CheckRangeEnqueuedInOrder(0, 4)); | 233 TRACE_CALL(CheckRangeEnqueuedInOrder(0, 4)); |
233 service_->Clear(extension_->id()); | 234 service_->Clear(extension_->id()); |
234 TRACE_CALL(CheckRangeEnqueuedInOrder(0, 4)); | 235 TRACE_CALL(CheckRangeEnqueuedInOrder(0, 4)); |
235 } | 236 } |
OLD | NEW |