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 "components/bookmarks/browser/bookmark_utils.h" | 5 #include "components/bookmarks/browser/bookmark_utils.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 const BookmarkNode* clone = folder->GetChild(0); | 379 const BookmarkNode* clone = folder->GetChild(0); |
380 ASSERT_TRUE(clone->GetMetaInfoMap()); | 380 ASSERT_TRUE(clone->GetMetaInfoMap()); |
381 EXPECT_EQ(2u, clone->GetMetaInfoMap()->size()); | 381 EXPECT_EQ(2u, clone->GetMetaInfoMap()->size()); |
382 std::string value; | 382 std::string value; |
383 EXPECT_TRUE(clone->GetMetaInfo("somekey", &value)); | 383 EXPECT_TRUE(clone->GetMetaInfo("somekey", &value)); |
384 EXPECT_EQ("somevalue", value); | 384 EXPECT_EQ("somevalue", value); |
385 EXPECT_TRUE(clone->GetMetaInfo("someotherkey", &value)); | 385 EXPECT_TRUE(clone->GetMetaInfo("someotherkey", &value)); |
386 EXPECT_EQ("someothervalue", value); | 386 EXPECT_EQ("someothervalue", value); |
387 } | 387 } |
388 | 388 |
| 389 TEST_F(BookmarkUtilsTest, HasManaged) { |
| 390 test::TestBookmarkClient client; |
| 391 scoped_ptr<BookmarkModel> model(client.CreateModel(false)); |
| 392 const BookmarkNode* user_node = model->AddURL(model->other_node(), |
| 393 0, |
| 394 ASCIIToUTF16("foo bar"), |
| 395 GURL("http://www.google.com")); |
| 396 const BookmarkNode* managed_node = model->AddURL(model->managed_node(), |
| 397 0, |
| 398 ASCIIToUTF16("Bugs"), |
| 399 GURL("http://crbug.com")); |
| 400 |
| 401 std::vector<const BookmarkNode*> nodes; |
| 402 EXPECT_FALSE(HasManaged(model.get(), nodes)); |
| 403 nodes.push_back(user_node); |
| 404 EXPECT_FALSE(HasManaged(model.get(), nodes)); |
| 405 nodes.push_back(managed_node); |
| 406 EXPECT_TRUE(HasManaged(model.get(), nodes)); |
| 407 } |
| 408 |
389 } // namespace | 409 } // namespace |
390 } // namespace bookmark_utils | 410 } // namespace bookmark_utils |
OLD | NEW |