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 28 matching lines...) Expand all Loading... |
39 explicit MockMediaGalleriesScanResultDialog( | 39 explicit MockMediaGalleriesScanResultDialog( |
40 const DialogDestroyedCallback& callback) | 40 const DialogDestroyedCallback& callback) |
41 : update_count_(0), | 41 : update_count_(0), |
42 dialog_destroyed_callback_(callback) { | 42 dialog_destroyed_callback_(callback) { |
43 } | 43 } |
44 | 44 |
45 virtual ~MockMediaGalleriesScanResultDialog() { | 45 virtual ~MockMediaGalleriesScanResultDialog() { |
46 dialog_destroyed_callback_.Run(update_count_); | 46 dialog_destroyed_callback_.Run(update_count_); |
47 } | 47 } |
48 | 48 |
49 // MockMediaGalleriesScanResultDialog implementation. | 49 // MediaGalleriesScanResultDialog implementation. |
50 virtual void UpdateResults() OVERRIDE { | 50 virtual void UpdateResults() OVERRIDE { |
51 update_count_++; | 51 update_count_++; |
52 } | 52 } |
53 | 53 |
54 // Number up times UpdateResults has been called. | 54 // Number up times UpdateResults has been called. |
55 int update_count() { | 55 int update_count() { |
56 return update_count_; | 56 return update_count_; |
57 } | 57 } |
58 | 58 |
59 private: | 59 private: |
| 60 // MediaGalleriesScanResultDialog implementation. |
| 61 virtual void AcceptDialogForTesting() OVERRIDE { |
| 62 } |
| 63 |
60 int update_count_; | 64 int update_count_; |
61 | 65 |
62 DialogDestroyedCallback dialog_destroyed_callback_; | 66 DialogDestroyedCallback dialog_destroyed_callback_; |
63 | 67 |
64 DISALLOW_COPY_AND_ASSIGN(MockMediaGalleriesScanResultDialog); | 68 DISALLOW_COPY_AND_ASSIGN(MockMediaGalleriesScanResultDialog); |
65 }; | 69 }; |
66 | 70 |
67 } // namespace | 71 } // namespace |
68 | 72 |
69 class MediaGalleriesScanResultDialogControllerTest : public testing::Test { | 73 class MediaGalleriesScanResultDialogControllerTest : public testing::Test { |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 MediaGalleriesScanResultDialogController::OrderedScanResults results = | 452 MediaGalleriesScanResultDialogController::OrderedScanResults results = |
449 controller()->GetGalleryList(); | 453 controller()->GetGalleryList(); |
450 ASSERT_EQ(5U, results.size()); | 454 ASSERT_EQ(5U, results.size()); |
451 EXPECT_EQ(first, results[0].pref_info.pref_id); | 455 EXPECT_EQ(first, results[0].pref_info.pref_id); |
452 EXPECT_EQ(second, results[1].pref_info.pref_id); | 456 EXPECT_EQ(second, results[1].pref_info.pref_id); |
453 EXPECT_EQ(third, results[2].pref_info.pref_id); | 457 EXPECT_EQ(third, results[2].pref_info.pref_id); |
454 EXPECT_EQ(fourth, results[3].pref_info.pref_id); | 458 EXPECT_EQ(fourth, results[3].pref_info.pref_id); |
455 EXPECT_EQ(fifth, results[4].pref_info.pref_id); | 459 EXPECT_EQ(fifth, results[4].pref_info.pref_id); |
456 controller()->DialogFinished(false); | 460 controller()->DialogFinished(false); |
457 } | 461 } |
OLD | NEW |