| 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/fake_distiller.h" | 5 #include "components/dom_distiller/core/fake_distiller.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 EXPECT_CALL(*this, Die()).Times(testing::AnyNumber()); | 21 EXPECT_CALL(*this, Die()).Times(testing::AnyNumber()); |
| 22 } | 22 } |
| 23 | 23 |
| 24 FakeDistiller::~FakeDistiller() { | 24 FakeDistiller::~FakeDistiller() { |
| 25 EXPECT_TRUE(destruction_allowed_); | 25 EXPECT_TRUE(destruction_allowed_); |
| 26 Die(); | 26 Die(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 void FakeDistiller::DistillPage( | 29 void FakeDistiller::DistillPage( |
| 30 const GURL& url, | 30 const GURL& url, |
| 31 scoped_ptr<DistillerPage> distiller_page, |
| 31 const DistillationFinishedCallback& article_callback, | 32 const DistillationFinishedCallback& article_callback, |
| 32 const DistillationUpdateCallback& page_callback) { | 33 const DistillationUpdateCallback& page_callback) { |
| 33 url_ = url; | 34 url_ = url; |
| 34 article_callback_ = article_callback; | 35 article_callback_ = article_callback; |
| 35 page_callback_ = page_callback; | 36 page_callback_ = page_callback; |
| 36 if (execute_callback_) { | 37 if (execute_callback_) { |
| 37 scoped_ptr<DistilledArticleProto> proto(new DistilledArticleProto); | 38 scoped_ptr<DistilledArticleProto> proto(new DistilledArticleProto); |
| 38 proto->add_pages()->set_url(url_.spec()); | 39 proto->add_pages()->set_url(url_.spec()); |
| 39 PostDistillerCallback(proto.Pass()); | 40 PostDistillerCallback(proto.Pass()); |
| 40 } | 41 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 62 EXPECT_FALSE(article_callback_.is_null()); | 63 EXPECT_FALSE(article_callback_.is_null()); |
| 63 | 64 |
| 64 base::AutoReset<bool> dont_delete_this_in_callback(&destruction_allowed_, | 65 base::AutoReset<bool> dont_delete_this_in_callback(&destruction_allowed_, |
| 65 false); | 66 false); |
| 66 article_callback_.Run(proto.Pass()); | 67 article_callback_.Run(proto.Pass()); |
| 67 article_callback_.Reset(); | 68 article_callback_.Reset(); |
| 68 } | 69 } |
| 69 | 70 |
| 70 } // namespace test | 71 } // namespace test |
| 71 } // namespace dom_distiller | 72 } // namespace dom_distiller |
| OLD | NEW |