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/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "components/dom_distiller/core/article_entry.h" | 8 #include "components/dom_distiller/core/article_entry.h" |
9 #include "components/dom_distiller/core/distilled_content_store.h" | 9 #include "components/dom_distiller/core/distilled_content_store.h" |
10 #include "components/dom_distiller/core/proto/distilled_article.pb.h" | 10 #include "components/dom_distiller/core/proto/distilled_article.pb.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 public: | 52 public: |
53 void OnLoadCallback(bool success, scoped_ptr<DistilledArticleProto> proto) { | 53 void OnLoadCallback(bool success, scoped_ptr<DistilledArticleProto> proto) { |
54 load_success_ = success; | 54 load_success_ = success; |
55 loaded_proto_ = proto.Pass(); | 55 loaded_proto_ = proto.Pass(); |
56 } | 56 } |
57 | 57 |
58 void OnSaveCallback(bool success) { save_success_ = success; } | 58 void OnSaveCallback(bool success) { save_success_ = success; } |
59 | 59 |
60 protected: | 60 protected: |
61 // testing::Test implementation: | 61 // testing::Test implementation: |
62 virtual void SetUp() override { | 62 void SetUp() override { |
63 store_.reset(new InMemoryContentStore(kDefaultMaxNumCachedEntries)); | 63 store_.reset(new InMemoryContentStore(kDefaultMaxNumCachedEntries)); |
64 save_success_ = false; | 64 save_success_ = false; |
65 load_success_ = false; | 65 load_success_ = false; |
66 loaded_proto_.reset(); | 66 loaded_proto_.reset(); |
67 } | 67 } |
68 | 68 |
69 scoped_ptr<InMemoryContentStore> store_; | 69 scoped_ptr<InMemoryContentStore> store_; |
70 bool save_success_; | 70 bool save_success_; |
71 bool load_success_; | 71 bool load_success_; |
72 scoped_ptr<DistilledArticleProto> loaded_proto_; | 72 scoped_ptr<DistilledArticleProto> loaded_proto_; |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 | 324 |
325 // Looking up the first entry by URL should fail when it is not in the cache. | 325 // Looking up the first entry by URL should fail when it is not in the cache. |
326 store_->LoadContent(first_entry_lookup, | 326 store_->LoadContent(first_entry_lookup, |
327 base::Bind(&InMemoryContentStoreTest::OnLoadCallback, | 327 base::Bind(&InMemoryContentStoreTest::OnLoadCallback, |
328 base::Unretained(this))); | 328 base::Unretained(this))); |
329 base::MessageLoop::current()->RunUntilIdle(); | 329 base::MessageLoop::current()->RunUntilIdle(); |
330 EXPECT_FALSE(load_success_); | 330 EXPECT_FALSE(load_success_); |
331 } | 331 } |
332 | 332 |
333 } // namespace dom_distiller | 333 } // namespace dom_distiller |
OLD | NEW |