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

Side by Side Diff: chrome/browser/browsing_data_file_system_helper_unittest.cc

Issue 9958107: Limiting the "Cookies and site data" form to "web safe" schemes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: License. Created 8 years, 8 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 | Annotate | Revision Log
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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/platform_file.h" 10 #include "base/platform_file.h"
(...skipping 15 matching lines...) Expand all
26 // Shorter names for fileapi::* constants. 26 // Shorter names for fileapi::* constants.
27 const fileapi::FileSystemType kTemporary = fileapi::kFileSystemTypeTemporary; 27 const fileapi::FileSystemType kTemporary = fileapi::kFileSystemTypeTemporary;
28 const fileapi::FileSystemType kPersistent = fileapi::kFileSystemTypePersistent; 28 const fileapi::FileSystemType kPersistent = fileapi::kFileSystemTypePersistent;
29 29
30 // We'll use these three distinct origins for testing, both as strings and as 30 // We'll use these three distinct origins for testing, both as strings and as
31 // GURLs in appropriate contexts. 31 // GURLs in appropriate contexts.
32 const char kTestOrigin1[] = "http://host1:1/"; 32 const char kTestOrigin1[] = "http://host1:1/";
33 const char kTestOrigin2[] = "http://host2:2/"; 33 const char kTestOrigin2[] = "http://host2:2/";
34 const char kTestOrigin3[] = "http://host3:3/"; 34 const char kTestOrigin3[] = "http://host3:3/";
35 35
36 // Extensions and Devtools should be ignored.
37 const char kTestOriginExt[] = "chrome-extension://abcdefghijklmnopqrstuvwxyz/";
38 const char kTestOriginDevTools[] = "chrome-devtools://abcdefghijklmnopqrstuvw/";
39
36 const GURL kOrigin1(kTestOrigin1); 40 const GURL kOrigin1(kTestOrigin1);
37 const GURL kOrigin2(kTestOrigin2); 41 const GURL kOrigin2(kTestOrigin2);
38 const GURL kOrigin3(kTestOrigin3); 42 const GURL kOrigin3(kTestOrigin3);
43 const GURL kOriginExt(kTestOriginExt);
44 const GURL kOriginDevTools(kTestOriginDevTools);
39 45
40 // TODO(mkwst): Update this size once the discussion in http://crbug.com/86114 46 // TODO(mkwst): Update this size once the discussion in http://crbug.com/86114
41 // is concluded. 47 // is concluded.
42 const int kEmptyFileSystemSize = 0; 48 const int kEmptyFileSystemSize = 0;
43 49
44 typedef std::list<BrowsingDataFileSystemHelper::FileSystemInfo> 50 typedef std::list<BrowsingDataFileSystemHelper::FileSystemInfo>
45 FileSystemInfoList; 51 FileSystemInfoList;
46 typedef scoped_ptr<FileSystemInfoList> ScopedFileSystemInfoList; 52 typedef scoped_ptr<FileSystemInfoList> ScopedFileSystemInfoList;
47 53
48 // The FileSystem APIs are all asynchronous; this testing class wraps up the 54 // The FileSystem APIs are all asynchronous; this testing class wraps up the
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 EXPECT_EQ(0, info->usage_temporary); 297 EXPECT_EQ(0, info->usage_temporary);
292 298
293 info++; 299 info++;
294 EXPECT_EQ(kOrigin2, info->origin); 300 EXPECT_EQ(kOrigin2, info->origin);
295 EXPECT_FALSE(info->has_persistent); 301 EXPECT_FALSE(info->has_persistent);
296 EXPECT_TRUE(info->has_temporary); 302 EXPECT_TRUE(info->has_temporary);
297 EXPECT_EQ(0, info->usage_persistent); 303 EXPECT_EQ(0, info->usage_persistent);
298 EXPECT_EQ(100, info->usage_temporary); 304 EXPECT_EQ(100, info->usage_temporary);
299 } 305 }
300 306
307 // Verifies that the CannedBrowsingDataFileSystemHelper correctly ignores
308 // extension and devtools schemes.
309 TEST_F(BrowsingDataFileSystemHelperTest, IgnoreExtensionsAndDevTools) {
310 ASSERT_TRUE(canned_helper_->empty());
311 canned_helper_->AddFileSystem(kOriginExt, kTemporary, 0);
312 ASSERT_TRUE(canned_helper_->empty());
313 canned_helper_->AddFileSystem(kOriginDevTools, kTemporary, 0);
314 ASSERT_TRUE(canned_helper_->empty());
315 }
316
301 } // namespace 317 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data_file_system_helper.cc ('k') | chrome/browser/browsing_data_indexed_db_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698