| 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/common/chrome_switches.h" | |
| 21 #include "chrome/common/extensions/extension.h" | 20 #include "chrome/common/extensions/extension.h" |
| 22 #include "chrome/common/extensions/extension_manifest_constants.h" | 21 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 23 #include "chrome/test/base/testing_profile.h" | 22 #include "chrome/test/base/testing_profile.h" |
| 24 #include "content/public/test/test_browser_thread.h" | 23 #include "content/public/test/test_browser_thread.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
| 26 | 25 |
| 27 namespace chrome { | 26 namespace chrome { |
| 28 | 27 |
| 29 namespace { | 28 namespace { |
| 30 | 29 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 46 } | 45 } |
| 47 | 46 |
| 48 virtual ~MediaGalleriesPreferencesTest() { | 47 virtual ~MediaGalleriesPreferencesTest() { |
| 49 // TestExtensionSystem uses DeleteSoon, so we need to delete the profile | 48 // TestExtensionSystem uses DeleteSoon, so we need to delete the profile |
| 50 // and then run the message queue to clean up. | 49 // and then run the message queue to clean up. |
| 51 profile_.reset(); | 50 profile_.reset(); |
| 52 MessageLoop::current()->RunAllPending(); | 51 MessageLoop::current()->RunAllPending(); |
| 53 } | 52 } |
| 54 | 53 |
| 55 virtual void SetUp() OVERRIDE { | 54 virtual void SetUp() OVERRIDE { |
| 56 CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 57 switches::kEnableMediaGalleryUI); | |
| 58 extensions_dir_ = profile_->GetPath().AppendASCII("Extensions"); | 55 extensions_dir_ = profile_->GetPath().AppendASCII("Extensions"); |
| 59 ASSERT_TRUE(file_util::CreateDirectory(extensions_dir_)); | 56 ASSERT_TRUE(file_util::CreateDirectory(extensions_dir_)); |
| 60 | 57 |
| 61 extensions::TestExtensionSystem* extension_system( | 58 extensions::TestExtensionSystem* extension_system( |
| 62 static_cast<extensions::TestExtensionSystem*>( | 59 static_cast<extensions::TestExtensionSystem*>( |
| 63 extensions::ExtensionSystem::Get(profile_.get()))); | 60 extensions::ExtensionSystem::Get(profile_.get()))); |
| 64 extension_service_ = extension_system->CreateExtensionService( | 61 extension_service_ = extension_system->CreateExtensionService( |
| 65 CommandLine::ForCurrentProcess(), extensions_dir_, false); | 62 CommandLine::ForCurrentProcess(), extensions_dir_, false); |
| 66 | 63 |
| 67 MediaGalleriesPreferences::RegisterUserPrefs(profile_->GetPrefs()); | 64 MediaGalleriesPreferences::RegisterUserPrefs(profile_->GetPrefs()); |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 | 398 |
| 402 gallery_prefs()->SetGalleryPermissionForExtension( | 399 gallery_prefs()->SetGalleryPermissionForExtension( |
| 403 *regular_permission_extension.get(), user_added_id, false); | 400 *regular_permission_extension.get(), user_added_id, false); |
| 404 expected_galleries_for_regular.erase(user_added_id); | 401 expected_galleries_for_regular.erase(user_added_id); |
| 405 Verify(); | 402 Verify(); |
| 406 } | 403 } |
| 407 | 404 |
| 408 } // namespace | 405 } // namespace |
| 409 | 406 |
| 410 } // namespace chrome | 407 } // namespace chrome |
| OLD | NEW |