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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/throttled_file_system_unittest.cc

Issue 1137383002: Show the eject button only for removabled and file handlers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed tests. Created 5 years, 7 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/chromeos/file_system_provider/throttled_file_system.h" 5 #include "chrome/browser/chromeos/file_system_provider/throttled_file_system.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/files/file.h" 9 #include "base/files/file.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/scoped_vector.h" 11 #include "base/memory/scoped_vector.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "chrome/browser/chromeos/file_system_provider/abort_callback.h" 13 #include "chrome/browser/chromeos/file_system_provider/abort_callback.h"
14 #include "chrome/browser/chromeos/file_system_provider/fake_provided_file_system .h" 14 #include "chrome/browser/chromeos/file_system_provider/fake_provided_file_system .h"
15 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info .h" 15 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info .h"
16 #include "chrome/common/extensions/api/file_system_provider_capabilities/file_sy stem_provider_capabilities_handler.h"
16 #include "content/public/test/test_browser_thread_bundle.h" 17 #include "content/public/test/test_browser_thread_bundle.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 19
19 namespace chromeos { 20 namespace chromeos {
20 namespace file_system_provider { 21 namespace file_system_provider {
21 namespace { 22 namespace {
22 23
23 const char kExtensionId[] = "mbflcebpggnecokmikipoihdbecnjfoj"; 24 const char kExtensionId[] = "mbflcebpggnecokmikipoihdbecnjfoj";
24 const char kFileSystemId[] = "camera-pictures"; 25 const char kFileSystemId[] = "camera-pictures";
25 const char kDisplayName[] = "Camera Pictures"; 26 const char kDisplayName[] = "Camera Pictures";
(...skipping 19 matching lines...) Expand all
45 ~FileSystemProviderThrottledFileSystemTest() override {} 46 ~FileSystemProviderThrottledFileSystemTest() override {}
46 47
47 void SetUp() override {} 48 void SetUp() override {}
48 49
49 // Initializes the throttled file system with |limit| number of opened files 50 // Initializes the throttled file system with |limit| number of opened files
50 // at once. If 0, then no limit. 51 // at once. If 0, then no limit.
51 void SetUpFileSystem(size_t limit) { 52 void SetUpFileSystem(size_t limit) {
52 MountOptions options(kFileSystemId, kDisplayName); 53 MountOptions options(kFileSystemId, kDisplayName);
53 options.opened_files_limit = limit; 54 options.opened_files_limit = limit;
54 55
55 ProvidedFileSystemInfo file_system_info(kExtensionId, options, 56 ProvidedFileSystemInfo file_system_info(
56 base::FilePath() /* mount_path */); 57 kExtensionId, options, base::FilePath() /* mount_path */,
58 false /* configurable */, extensions::SOURCE_FILE);
57 59
58 file_system_.reset(new ThrottledFileSystem( 60 file_system_.reset(new ThrottledFileSystem(
59 make_scoped_ptr(new FakeProvidedFileSystem(file_system_info)))); 61 make_scoped_ptr(new FakeProvidedFileSystem(file_system_info))));
60 } 62 }
61 63
62 content::TestBrowserThreadBundle thread_bundle_; 64 content::TestBrowserThreadBundle thread_bundle_;
63 scoped_ptr<ThrottledFileSystem> file_system_; 65 scoped_ptr<ThrottledFileSystem> file_system_;
64 }; 66 };
65 67
66 TEST_F(FileSystemProviderThrottledFileSystemTest, OpenFile_LimitedToOneAtOnce) { 68 TEST_F(FileSystemProviderThrottledFileSystemTest, OpenFile_LimitedToOneAtOnce) {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 150
149 base::RunLoop().RunUntilIdle(); 151 base::RunLoop().RunUntilIdle();
150 152
151 ASSERT_EQ(1u, first_open_log.size()); 153 ASSERT_EQ(1u, first_open_log.size());
152 EXPECT_EQ(base::File::FILE_OK, first_open_log[0].second); 154 EXPECT_EQ(base::File::FILE_OK, first_open_log[0].second);
153 EXPECT_EQ(0u, second_open_log.size()); 155 EXPECT_EQ(0u, second_open_log.size());
154 } 156 }
155 157
156 } // namespace file_system_provider 158 } // namespace file_system_provider
157 } // namespace chromeos 159 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698