| 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 // MediaGalleriesPreferences unit tests. | 5 // MediaGalleriesPreferences unit tests. |
| 6 | 6 |
| 7 #include "chrome/browser/media_gallery/media_galleries_preferences.h" | 7 #include "chrome/browser/media_gallery/media_galleries_preferences.h" |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.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/message_loop.h" | 13 #include "base/message_loop.h" |
| 14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "chrome/browser/extensions/extension_service.h" | 16 #include "chrome/browser/extensions/extension_service.h" |
| 17 #include "chrome/browser/extensions/extension_system.h" | 17 #include "chrome/browser/extensions/extension_system.h" |
| 18 #include "chrome/browser/extensions/test_extension_system.h" | 18 #include "chrome/browser/extensions/test_extension_system.h" |
| 19 #include "chrome/browser/media_gallery/media_file_system_registry.h" | 19 #include "chrome/browser/media_gallery/media_file_system_registry.h" |
| 20 #include "chrome/browser/system_monitor/media_storage_util.h" | 20 #include "chrome/browser/system_monitor/media_storage_util.h" |
| 21 #include "chrome/common/extensions/extension.h" | 21 #include "chrome/common/extensions/extension.h" |
| 22 #include "chrome/common/extensions/extension_manifest_constants.h" | 22 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 23 #include "chrome/test/base/testing_profile.h" | 23 #include "chrome/test/base/testing_profile.h" |
| 24 #include "content/public/test/test_browser_thread.h" | 24 #include "content/public/test/test_browser_thread.h" |
| 25 #include "sync/api/string_ordinal.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
| 26 | 27 |
| 27 namespace chrome { | 28 namespace chrome { |
| 28 | 29 |
| 29 namespace { | 30 namespace { |
| 30 | 31 |
| 31 class MediaStorageUtilTest : public MediaStorageUtil { | 32 class MediaStorageUtilTest : public MediaStorageUtil { |
| 32 public: | 33 public: |
| 33 static void SetTestingMode() { | 34 static void SetTestingMode() { |
| 34 SetGetDeviceInfoFromPathFunctionForTesting( | 35 SetGetDeviceInfoFromPathFunctionForTesting( |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 &errors); | 214 &errors); |
| 214 EXPECT_TRUE(extension.get() != NULL) << errors; | 215 EXPECT_TRUE(extension.get() != NULL) << errors; |
| 215 EXPECT_TRUE(extensions::Extension::IdIsValid(extension->id())); | 216 EXPECT_TRUE(extensions::Extension::IdIsValid(extension->id())); |
| 216 if (!extension.get() || | 217 if (!extension.get() || |
| 217 !extensions::Extension::IdIsValid(extension->id())) { | 218 !extensions::Extension::IdIsValid(extension->id())) { |
| 218 return NULL; | 219 return NULL; |
| 219 } | 220 } |
| 220 | 221 |
| 221 extension_service_->extension_prefs()->OnExtensionInstalled( | 222 extension_service_->extension_prefs()->OnExtensionInstalled( |
| 222 extension, extensions::Extension::ENABLED, false, | 223 extension, extensions::Extension::ENABLED, false, |
| 223 StringOrdinal::CreateInitialOrdinal()); | 224 syncer::StringOrdinal::CreateInitialOrdinal()); |
| 224 | 225 |
| 225 return extension; | 226 return extension; |
| 226 } | 227 } |
| 227 | 228 |
| 228 // Needed for extension service & friends to work. | 229 // Needed for extension service & friends to work. |
| 229 MessageLoop loop_; | 230 MessageLoop loop_; |
| 230 content::TestBrowserThread ui_thread_; | 231 content::TestBrowserThread ui_thread_; |
| 231 content::TestBrowserThread file_thread_; | 232 content::TestBrowserThread file_thread_; |
| 232 | 233 |
| 233 scoped_ptr<TestingProfile> profile_; | 234 scoped_ptr<TestingProfile> profile_; |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 // Check that adding one of them again works as expected. | 519 // Check that adding one of them again works as expected. |
| 519 MediaGalleryPrefId id = gallery_prefs()->AddGallery( | 520 MediaGalleryPrefId id = gallery_prefs()->AddGallery( |
| 520 device_id, device_name, relative_path, true /*user*/); | 521 device_id, device_name, relative_path, true /*user*/); |
| 521 EXPECT_EQ(dev2_path2_id, id); | 522 EXPECT_EQ(dev2_path2_id, id); |
| 522 Verify(); | 523 Verify(); |
| 523 } | 524 } |
| 524 | 525 |
| 525 } // namespace | 526 } // namespace |
| 526 | 527 |
| 527 } // namespace chrome | 528 } // namespace chrome |
| OLD | NEW |