| OLD | NEW |
| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 controller_(NULL), | 38 controller_(NULL), |
| 39 profile_(new TestingProfile()), | 39 profile_(new TestingProfile()), |
| 40 weak_factory_(this) { | 40 weak_factory_(this) { |
| 41 } | 41 } |
| 42 | 42 |
| 43 virtual ~MediaGalleriesScanResultControllerTest() { | 43 virtual ~MediaGalleriesScanResultControllerTest() { |
| 44 EXPECT_FALSE(controller_); | 44 EXPECT_FALSE(controller_); |
| 45 EXPECT_FALSE(dialog_); | 45 EXPECT_FALSE(dialog_); |
| 46 } | 46 } |
| 47 | 47 |
| 48 virtual void SetUp() OVERRIDE { | 48 virtual void SetUp() override { |
| 49 ASSERT_TRUE(storage_monitor::TestStorageMonitor::CreateAndInstall()); | 49 ASSERT_TRUE(storage_monitor::TestStorageMonitor::CreateAndInstall()); |
| 50 | 50 |
| 51 extensions::TestExtensionSystem* extension_system( | 51 extensions::TestExtensionSystem* extension_system( |
| 52 static_cast<extensions::TestExtensionSystem*>( | 52 static_cast<extensions::TestExtensionSystem*>( |
| 53 extensions::ExtensionSystem::Get(profile_.get()))); | 53 extensions::ExtensionSystem::Get(profile_.get()))); |
| 54 extension_system->CreateExtensionService( | 54 extension_system->CreateExtensionService( |
| 55 CommandLine::ForCurrentProcess(), base::FilePath(), false); | 55 CommandLine::ForCurrentProcess(), base::FilePath(), false); |
| 56 | 56 |
| 57 gallery_prefs_.reset(new MediaGalleriesPreferences(profile_.get())); | 57 gallery_prefs_.reset(new MediaGalleriesPreferences(profile_.get())); |
| 58 base::RunLoop loop; | 58 base::RunLoop loop; |
| 59 gallery_prefs_->EnsureInitialized(loop.QuitClosure()); | 59 gallery_prefs_->EnsureInitialized(loop.QuitClosure()); |
| 60 loop.Run(); | 60 loop.Run(); |
| 61 | 61 |
| 62 std::vector<std::string> read_permissions; | 62 std::vector<std::string> read_permissions; |
| 63 read_permissions.push_back( | 63 read_permissions.push_back( |
| 64 extensions::MediaGalleriesPermission::kReadPermission); | 64 extensions::MediaGalleriesPermission::kReadPermission); |
| 65 extension_ = AddMediaGalleriesApp("read", read_permissions, profile_.get()); | 65 extension_ = AddMediaGalleriesApp("read", read_permissions, profile_.get()); |
| 66 } | 66 } |
| 67 | 67 |
| 68 virtual void TearDown() OVERRIDE { | 68 virtual void TearDown() override { |
| 69 storage_monitor::TestStorageMonitor::Destroy(); | 69 storage_monitor::TestStorageMonitor::Destroy(); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void StartDialog() { | 72 void StartDialog() { |
| 73 ASSERT_FALSE(controller_); | 73 ASSERT_FALSE(controller_); |
| 74 controller_ = new MediaGalleriesScanResultController( | 74 controller_ = new MediaGalleriesScanResultController( |
| 75 *extension_.get(), | 75 *extension_.get(), |
| 76 gallery_prefs_.get(), | 76 gallery_prefs_.get(), |
| 77 base::Bind( | 77 base::Bind( |
| 78 &MediaGalleriesScanResultControllerTest::CreateMockDialog, | 78 &MediaGalleriesScanResultControllerTest::CreateMockDialog, |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 MediaGalleriesDialogController::Entries results = | 415 MediaGalleriesDialogController::Entries results = |
| 416 controller()->GetSectionEntries(0); | 416 controller()->GetSectionEntries(0); |
| 417 ASSERT_EQ(5U, results.size()); | 417 ASSERT_EQ(5U, results.size()); |
| 418 EXPECT_EQ(first, results[0].pref_info.pref_id); | 418 EXPECT_EQ(first, results[0].pref_info.pref_id); |
| 419 EXPECT_EQ(second, results[1].pref_info.pref_id); | 419 EXPECT_EQ(second, results[1].pref_info.pref_id); |
| 420 EXPECT_EQ(third, results[2].pref_info.pref_id); | 420 EXPECT_EQ(third, results[2].pref_info.pref_id); |
| 421 EXPECT_EQ(fourth, results[3].pref_info.pref_id); | 421 EXPECT_EQ(fourth, results[3].pref_info.pref_id); |
| 422 EXPECT_EQ(fifth, results[4].pref_info.pref_id); | 422 EXPECT_EQ(fifth, results[4].pref_info.pref_id); |
| 423 controller()->DialogFinished(false); | 423 controller()->DialogFinished(false); |
| 424 } | 424 } |
| OLD | NEW |