| 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/net/chrome_network_delegate.h" | 5 #include "chrome/browser/net/chrome_network_delegate.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) | 594 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) |
| 595 // Platforms other than Chrome OS and Android have access to any files. | 595 // Platforms other than Chrome OS and Android have access to any files. |
| 596 EXPECT_TRUE(IsAccessAllowed("/", "")); | 596 EXPECT_TRUE(IsAccessAllowed("/", "")); |
| 597 EXPECT_TRUE(IsAccessAllowed("/foo.txt", "")); | 597 EXPECT_TRUE(IsAccessAllowed("/foo.txt", "")); |
| 598 #endif | 598 #endif |
| 599 | 599 |
| 600 #if defined(OS_CHROMEOS) || defined(OS_ANDROID) | 600 #if defined(OS_CHROMEOS) || defined(OS_ANDROID) |
| 601 // Chrome OS and Android don't have access to random files. | 601 // Chrome OS and Android don't have access to random files. |
| 602 EXPECT_FALSE(IsAccessAllowed("/", "")); | 602 EXPECT_FALSE(IsAccessAllowed("/", "")); |
| 603 EXPECT_FALSE(IsAccessAllowed("/foo.txt", "")); | 603 EXPECT_FALSE(IsAccessAllowed("/foo.txt", "")); |
| 604 // Empty path should not be allowed. |
| 605 EXPECT_FALSE(IsAccessAllowed("", "")); |
| 604 #endif | 606 #endif |
| 605 | 607 |
| 606 #if defined(OS_CHROMEOS) | 608 #if defined(OS_CHROMEOS) |
| 607 // Chrome OS allows the following directories. | 609 // Chrome OS allows the following directories. |
| 608 EXPECT_TRUE(IsAccessAllowed("/home/chronos/user/Downloads", "")); | 610 EXPECT_TRUE(IsAccessAllowed("/home/chronos/user/Downloads", "")); |
| 609 EXPECT_TRUE(IsAccessAllowed("/home/chronos/user/log", "")); | 611 EXPECT_TRUE(IsAccessAllowed("/home/chronos/user/log", "")); |
| 610 EXPECT_TRUE(IsAccessAllowed("/home/chronos/user/WebRTC Logs", "")); | 612 EXPECT_TRUE(IsAccessAllowed("/home/chronos/user/WebRTC Logs", "")); |
| 611 EXPECT_TRUE(IsAccessAllowed("/media", "")); | 613 EXPECT_TRUE(IsAccessAllowed("/media", "")); |
| 612 EXPECT_TRUE(IsAccessAllowed("/opt/oem", "")); | 614 EXPECT_TRUE(IsAccessAllowed("/opt/oem", "")); |
| 613 EXPECT_TRUE(IsAccessAllowed("/usr/share/chromeos-assets", "")); | 615 EXPECT_TRUE(IsAccessAllowed("/usr/share/chromeos-assets", "")); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 636 | 638 |
| 637 // Files in external storage are allowed. | 639 // Files in external storage are allowed. |
| 638 base::FilePath external_storage_path; | 640 base::FilePath external_storage_path; |
| 639 PathService::Get(base::DIR_ANDROID_EXTERNAL_STORAGE, &external_storage_path); | 641 PathService::Get(base::DIR_ANDROID_EXTERNAL_STORAGE, &external_storage_path); |
| 640 EXPECT_TRUE(IsAccessAllowed( | 642 EXPECT_TRUE(IsAccessAllowed( |
| 641 external_storage_path.AppendASCII("foo.txt").AsUTF8Unsafe(), "")); | 643 external_storage_path.AppendASCII("foo.txt").AsUTF8Unsafe(), "")); |
| 642 // The external storage root itself is not allowed. | 644 // The external storage root itself is not allowed. |
| 643 EXPECT_FALSE(IsAccessAllowed(external_storage_path.AsUTF8Unsafe(), "")); | 645 EXPECT_FALSE(IsAccessAllowed(external_storage_path.AsUTF8Unsafe(), "")); |
| 644 #endif | 646 #endif |
| 645 } | 647 } |
| OLD | NEW |