Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: chrome/browser/net/chrome_network_delegate_unittest.cc

Issue 2786583002: chromeos: Check both original and absolute paths for file: scheme (Closed)
Patch Set: remove dcheck Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/net/chrome_network_delegate.cc ('k') | chromecast/browser/cast_network_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698