| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "storage/browser/fileapi/file_system_url.h" | 9 #include "storage/browser/fileapi/file_system_url.h" |
| 10 #include "storage/browser/fileapi/isolated_context.h" | 10 #include "storage/browser/fileapi/isolated_context.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 } // namespace | 49 } // namespace |
| 50 | 50 |
| 51 class IsolatedContextTest : public testing::Test { | 51 class IsolatedContextTest : public testing::Test { |
| 52 public: | 52 public: |
| 53 IsolatedContextTest() { | 53 IsolatedContextTest() { |
| 54 for (size_t i = 0; i < arraysize(kTestPaths); ++i) | 54 for (size_t i = 0; i < arraysize(kTestPaths); ++i) |
| 55 fileset_.insert(kTestPaths[i].NormalizePathSeparators()); | 55 fileset_.insert(kTestPaths[i].NormalizePathSeparators()); |
| 56 } | 56 } |
| 57 | 57 |
| 58 virtual void SetUp() { | 58 void SetUp() override { |
| 59 IsolatedContext::FileInfoSet files; | 59 IsolatedContext::FileInfoSet files; |
| 60 for (size_t i = 0; i < arraysize(kTestPaths); ++i) { | 60 for (size_t i = 0; i < arraysize(kTestPaths); ++i) { |
| 61 std::string name; | 61 std::string name; |
| 62 ASSERT_TRUE( | 62 ASSERT_TRUE( |
| 63 files.AddPath(kTestPaths[i].NormalizePathSeparators(), &name)); | 63 files.AddPath(kTestPaths[i].NormalizePathSeparators(), &name)); |
| 64 names_.push_back(name); | 64 names_.push_back(name); |
| 65 } | 65 } |
| 66 id_ = IsolatedContext::GetInstance()->RegisterDraggedFileSystem(files); | 66 id_ = IsolatedContext::GetInstance()->RegisterDraggedFileSystem(files); |
| 67 IsolatedContext::GetInstance()->AddReference(id_); | 67 IsolatedContext::GetInstance()->AddReference(id_); |
| 68 ASSERT_FALSE(id_.empty()); | 68 ASSERT_FALSE(id_.empty()); |
| 69 } | 69 } |
| 70 | 70 |
| 71 virtual void TearDown() { | 71 void TearDown() override { |
| 72 IsolatedContext::GetInstance()->RemoveReference(id_); | 72 IsolatedContext::GetInstance()->RemoveReference(id_); |
| 73 } | 73 } |
| 74 | 74 |
| 75 IsolatedContext* isolated_context() const { | 75 IsolatedContext* isolated_context() const { |
| 76 return IsolatedContext::GetInstance(); | 76 return IsolatedContext::GetInstance(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 protected: | 79 protected: |
| 80 std::string id_; | 80 std::string id_; |
| 81 std::multiset<base::FilePath> fileset_; | 81 std::multiset<base::FilePath> fileset_; |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 FileSystemMountOption cracked_option; | 352 FileSystemMountOption cracked_option; |
| 353 ASSERT_TRUE(isolated_context()->CrackVirtualPath( | 353 ASSERT_TRUE(isolated_context()->CrackVirtualPath( |
| 354 whole_virtual_path, &cracked_id, NULL, &cracked_inner_id, | 354 whole_virtual_path, &cracked_id, NULL, &cracked_inner_id, |
| 355 &cracked_path, &cracked_option)); | 355 &cracked_path, &cracked_option)); |
| 356 ASSERT_EQ(database_fsid, cracked_id); | 356 ASSERT_EQ(database_fsid, cracked_id); |
| 357 ASSERT_EQ(test_virtual_path, cracked_path); | 357 ASSERT_EQ(test_virtual_path, cracked_path); |
| 358 EXPECT_TRUE(cracked_inner_id.empty()); | 358 EXPECT_TRUE(cracked_inner_id.empty()); |
| 359 } | 359 } |
| 360 | 360 |
| 361 } // namespace content | 361 } // namespace content |
| OLD | NEW |