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" |
(...skipping 27 matching lines...) Expand all Loading... |
38 class MediaGalleriesPreferencesTest : public testing::Test { | 38 class MediaGalleriesPreferencesTest : public testing::Test { |
39 public: | 39 public: |
40 MediaGalleriesPreferencesTest() | 40 MediaGalleriesPreferencesTest() |
41 : ui_thread_(content::BrowserThread::UI, &loop_), | 41 : ui_thread_(content::BrowserThread::UI, &loop_), |
42 file_thread_(content::BrowserThread::FILE, &loop_), | 42 file_thread_(content::BrowserThread::FILE, &loop_), |
43 profile_(new TestingProfile()), | 43 profile_(new TestingProfile()), |
44 extension_service_(NULL), | 44 extension_service_(NULL), |
45 default_galleries_count_(0) { | 45 default_galleries_count_(0) { |
46 } | 46 } |
47 | 47 |
48 virtual ~MediaGalleriesPreferencesTest() {} | 48 virtual ~MediaGalleriesPreferencesTest() { |
| 49 // TestExtensionSystem uses DeleteSoon, so we need to delete the profile |
| 50 // and then run the message queue to clean up. |
| 51 profile_.reset(); |
| 52 MessageLoop::current()->RunAllPending(); |
| 53 } |
49 | 54 |
50 virtual void SetUp() OVERRIDE { | 55 virtual void SetUp() OVERRIDE { |
51 CommandLine::ForCurrentProcess()->AppendSwitch( | 56 CommandLine::ForCurrentProcess()->AppendSwitch( |
52 switches::kEnableMediaGalleryUI); | 57 switches::kEnableMediaGalleryUI); |
53 extensions_dir_ = profile_->GetPath().AppendASCII("Extensions"); | 58 extensions_dir_ = profile_->GetPath().AppendASCII("Extensions"); |
54 ASSERT_TRUE(file_util::CreateDirectory(extensions_dir_)); | 59 ASSERT_TRUE(file_util::CreateDirectory(extensions_dir_)); |
55 | 60 |
56 extensions::TestExtensionSystem* extension_system( | 61 extensions::TestExtensionSystem* extension_system( |
57 static_cast<extensions::TestExtensionSystem*>( | 62 static_cast<extensions::TestExtensionSystem*>( |
58 extensions::ExtensionSystem::Get(profile_.get()))); | 63 extensions::ExtensionSystem::Get(profile_.get()))); |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 | 401 |
397 gallery_prefs()->SetGalleryPermissionForExtension( | 402 gallery_prefs()->SetGalleryPermissionForExtension( |
398 *regular_permission_extension.get(), user_added_id, false); | 403 *regular_permission_extension.get(), user_added_id, false); |
399 expected_galleries_for_regular.erase(user_added_id); | 404 expected_galleries_for_regular.erase(user_added_id); |
400 Verify(); | 405 Verify(); |
401 } | 406 } |
402 | 407 |
403 } // namespace | 408 } // namespace |
404 | 409 |
405 } // namespace chrome | 410 } // namespace chrome |
OLD | NEW |