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

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

Issue 1148293006: Rename service/service_factory of file_system_provider and launcher_search_provider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: lsp 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 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 "chrome/browser/chromeos/file_system_provider/service.h" 5 #include "chrome/browser/chromeos/file_system_provider/file_system_provider_serv ice.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/files/file.h" 10 #include "base/files/file.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.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/mount_path_util.h" 15 #include "chrome/browser/chromeos/file_system_provider/mount_path_util.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 162
163 // Creates a fake extension with the specified |extension_id|. 163 // Creates a fake extension with the specified |extension_id|.
164 scoped_refptr<extensions::Extension> CreateFakeExtension( 164 scoped_refptr<extensions::Extension> CreateFakeExtension(
165 const std::string& extension_id) { 165 const std::string& extension_id) {
166 base::DictionaryValue manifest; 166 base::DictionaryValue manifest;
167 std::string error; 167 std::string error;
168 manifest.SetStringWithoutPathExpansion(extensions::manifest_keys::kVersion, 168 manifest.SetStringWithoutPathExpansion(extensions::manifest_keys::kVersion,
169 "1.0.0.0"); 169 "1.0.0.0");
170 manifest.SetStringWithoutPathExpansion(extensions::manifest_keys::kName, 170 manifest.SetStringWithoutPathExpansion(extensions::manifest_keys::kName,
171 "unused"); 171 "unused");
172 return extensions::Extension::Create(base::FilePath(), 172 return extensions::Extension::Create(
173 extensions::Manifest::UNPACKED, 173 base::FilePath(), extensions::Manifest::UNPACKED, manifest,
174 manifest, 174 extensions::Extension::NO_FLAGS, extension_id, &error);
175 extensions::Extension::NO_FLAGS,
176 extension_id,
177 &error);
178 } 175 }
179 176
180 } // namespace 177 } // namespace
181 178
182 class FileSystemProviderServiceTest : public testing::Test { 179 class FileSystemProviderServiceTest : public testing::Test {
183 protected: 180 protected:
184 FileSystemProviderServiceTest() : profile_(NULL) {} 181 FileSystemProviderServiceTest() : profile_(NULL) {}
185 182
186 ~FileSystemProviderServiceTest() override {} 183 ~FileSystemProviderServiceTest() override {}
187 184
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 LoggingObserver observer; 353 LoggingObserver observer;
357 service_->AddObserver(&observer); 354 service_->AddObserver(&observer);
358 355
359 EXPECT_EQ(base::File::FILE_OK, 356 EXPECT_EQ(base::File::FILE_OK,
360 service_->MountFileSystem( 357 service_->MountFileSystem(
361 kExtensionId, MountOptions(kFileSystemId, kDisplayName))); 358 kExtensionId, MountOptions(kFileSystemId, kDisplayName)));
362 ASSERT_EQ(1u, observer.mounts.size()); 359 ASSERT_EQ(1u, observer.mounts.size());
363 360
364 // Directly call the observer's method. 361 // Directly call the observer's method.
365 service_->OnExtensionUnloaded( 362 service_->OnExtensionUnloaded(
366 profile_, 363 profile_, extension_.get(),
367 extension_.get(),
368 extensions::UnloadedExtensionInfo::REASON_DISABLE); 364 extensions::UnloadedExtensionInfo::REASON_DISABLE);
369 365
370 ASSERT_EQ(1u, observer.unmounts.size()); 366 ASSERT_EQ(1u, observer.unmounts.size());
371 EXPECT_EQ(base::File::FILE_OK, observer.unmounts[0].error()); 367 EXPECT_EQ(base::File::FILE_OK, observer.unmounts[0].error());
372 368
373 EXPECT_EQ(kExtensionId, 369 EXPECT_EQ(kExtensionId,
374 observer.unmounts[0].file_system_info().extension_id()); 370 observer.unmounts[0].file_system_info().extension_id());
375 EXPECT_EQ(kFileSystemId, 371 EXPECT_EQ(kFileSystemId,
376 observer.unmounts[0].file_system_info().file_system_id()); 372 observer.unmounts[0].file_system_info().file_system_id());
377 373
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 EXPECT_EQ(1u, observer.unmounts.size()); 536 EXPECT_EQ(1u, observer.unmounts.size());
541 EXPECT_FALSE(registry_->file_system_info()); 537 EXPECT_FALSE(registry_->file_system_info());
542 EXPECT_FALSE(registry_->watchers()); 538 EXPECT_FALSE(registry_->watchers());
543 } 539 }
544 540
545 service_->RemoveObserver(&observer); 541 service_->RemoveObserver(&observer);
546 } 542 }
547 543
548 } // namespace file_system_provider 544 } // namespace file_system_provider
549 } // namespace chromeos 545 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698