| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/dom_distiller/core/task_tracker.h" | 5 #include "components/dom_distiller/core/task_tracker.h" |
| 6 | 6 |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "components/dom_distiller/core/article_distillation_update.h" |
| 8 #include "components/dom_distiller/core/article_entry.h" | 9 #include "components/dom_distiller/core/article_entry.h" |
| 9 #include "components/dom_distiller/core/fake_distiller.h" | 10 #include "components/dom_distiller/core/fake_distiller.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 12 |
| 12 using testing::Return; | 13 using testing::Return; |
| 13 using testing::_; | 14 using testing::_; |
| 14 | 15 |
| 15 namespace dom_distiller { | 16 namespace dom_distiller { |
| 16 namespace test { | 17 namespace test { |
| 17 | 18 |
| 18 class FakeViewRequestDelegate : public ViewRequestDelegate { | 19 class FakeViewRequestDelegate : public ViewRequestDelegate { |
| 19 public: | 20 public: |
| 20 virtual ~FakeViewRequestDelegate() {} | 21 virtual ~FakeViewRequestDelegate() {} |
| 21 MOCK_METHOD1(OnArticleReady, | 22 MOCK_METHOD1(OnArticleReady, |
| 22 void(const DistilledArticleProto* article_proto)); | 23 void(const DistilledArticleProto* article_proto)); |
| 24 MOCK_METHOD1(OnArticleUpdated, |
| 25 void(ArticleDistillationUpdate article_update)); |
| 23 }; | 26 }; |
| 24 | 27 |
| 25 class TestCancelCallback { | 28 class TestCancelCallback { |
| 26 public: | 29 public: |
| 27 TestCancelCallback() : cancelled_(false) {} | 30 TestCancelCallback() : cancelled_(false) {} |
| 28 TaskTracker::CancelCallback GetCallback() { | 31 TaskTracker::CancelCallback GetCallback() { |
| 29 return base::Bind(&TestCancelCallback::Cancel, base::Unretained(this)); | 32 return base::Bind(&TestCancelCallback::Cancel, base::Unretained(this)); |
| 30 } | 33 } |
| 31 void Cancel(TaskTracker*) { cancelled_ = true; } | 34 void Cancel(TaskTracker*) { cancelled_ = true; } |
| 32 bool Cancelled() { return cancelled_; } | 35 bool Cancelled() { return cancelled_; } |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 EXPECT_CALL(save_callback, Save(_, _, _)); | 159 EXPECT_CALL(save_callback, Save(_, _, _)); |
| 157 | 160 |
| 158 task_tracker.StartDistiller(&distiller_factory); | 161 task_tracker.StartDistiller(&distiller_factory); |
| 159 base::RunLoop().RunUntilIdle(); | 162 base::RunLoop().RunUntilIdle(); |
| 160 | 163 |
| 161 EXPECT_TRUE(cancel_callback.Cancelled()); | 164 EXPECT_TRUE(cancel_callback.Cancelled()); |
| 162 } | 165 } |
| 163 | 166 |
| 164 } // namespace test | 167 } // namespace test |
| 165 } // namespace dom_distiller | 168 } // namespace dom_distiller |
| OLD | NEW |