Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(356)

Side by Side Diff: ios/chrome/browser/reading_list/reading_list_model_unittest.cc

Issue 2362063004: Find reading list entry state in model from url (Closed)
Patch Set: Addressing comments + tests Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ios/chrome/browser/reading_list/reading_list_model_impl.h" 6 #include "ios/chrome/browser/reading_list/reading_list_model_impl.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace { 9 namespace {
10 10
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 // Action. 327 // Action.
328 bool result = model_->CallbackEntryURL( 328 bool result = model_->CallbackEntryURL(
329 callback_url, 329 callback_url,
330 base::Bind(&ReadingListModelTest::Callback, base::Unretained(this))); 330 base::Bind(&ReadingListModelTest::Callback, base::Unretained(this)));
331 331
332 // Test. 332 // Test.
333 EXPECT_FALSE(result); 333 EXPECT_FALSE(result);
334 EXPECT_FALSE(CallbackCalled()); 334 EXPECT_FALSE(CallbackCalled());
335 } 335 }
336 336
337 TEST_F(ReadingListModelTest, EntryStateByURL) {
338 // Setup.
339 const GURL not_present("http://not.present");
340 const GURL unread("http://foo.bar");
341 model_->AddEntry(unread, "sample");
342 const GURL read("http://example.com");
343 model_->AddEntry(read, "sample");
344 model_->MarkReadByURL(read);
345
346 // Action/Test.
347 EXPECT_EQ(ReadingListModel::EntryState::READ, model_->EntryStateByURL(read));
348 EXPECT_EQ(ReadingListModel::EntryState::UNREAD,
349 model_->EntryStateByURL(unread));
350 EXPECT_EQ(ReadingListModel::EntryState::NOT_PRESENT,
351 model_->EntryStateByURL(not_present));
352 }
353
337 } // namespace 354 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698