| 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 "ios/chrome/browser/ui/bookmarks/bookmark_ios_unittest.h" | 5 #include "ios/chrome/browser/ui/bookmarks/bookmark_ios_unittest.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
| 9 #include "components/bookmarks/browser/bookmark_model.h" | 9 #include "components/bookmarks/browser/bookmark_model.h" |
| 10 #include "components/bookmarks/test/bookmark_test_helpers.h" | 10 #include "components/bookmarks/test/bookmark_test_helpers.h" |
| 11 #include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" | 11 #include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" |
| 12 #import "ios/chrome/browser/browser_state/test_chrome_browser_state.h" | 12 #import "ios/chrome/browser/browser_state/test_chrome_browser_state.h" |
| 13 #include "ios/web/public/test/test_web_thread.h" | 13 #include "ios/web/public/test/test_web_thread.h" |
| 14 | 14 |
| 15 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 16 #error "This file requires ARC support." |
| 17 #endif |
| 18 |
| 15 using bookmarks::BookmarkNode; | 19 using bookmarks::BookmarkNode; |
| 16 | 20 |
| 17 BookmarkIOSUnitTest::BookmarkIOSUnitTest() {} | 21 BookmarkIOSUnitTest::BookmarkIOSUnitTest() {} |
| 18 BookmarkIOSUnitTest::~BookmarkIOSUnitTest() {} | 22 BookmarkIOSUnitTest::~BookmarkIOSUnitTest() {} |
| 19 | 23 |
| 20 void BookmarkIOSUnitTest::SetUp() { | 24 void BookmarkIOSUnitTest::SetUp() { |
| 21 // Get a BookmarkModel from the test ChromeBrowserState. | 25 // Get a BookmarkModel from the test ChromeBrowserState. |
| 22 TestChromeBrowserState::Builder test_cbs_builder; | 26 TestChromeBrowserState::Builder test_cbs_builder; |
| 23 chrome_browser_state_ = test_cbs_builder.Build(); | 27 chrome_browser_state_ = test_cbs_builder.Build(); |
| 24 chrome_browser_state_->CreateBookmarkModel(true); | 28 chrome_browser_state_->CreateBookmarkModel(true); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 39 NSString* title) { | 43 NSString* title) { |
| 40 base::string16 c_title = base::SysNSStringToUTF16(title); | 44 base::string16 c_title = base::SysNSStringToUTF16(title); |
| 41 return _bookmarkModel->AddFolder(parent, parent->child_count(), c_title); | 45 return _bookmarkModel->AddFolder(parent, parent->child_count(), c_title); |
| 42 } | 46 } |
| 43 | 47 |
| 44 void BookmarkIOSUnitTest::ChangeTitle(NSString* title, | 48 void BookmarkIOSUnitTest::ChangeTitle(NSString* title, |
| 45 const BookmarkNode* node) { | 49 const BookmarkNode* node) { |
| 46 base::string16 c_title = base::SysNSStringToUTF16(title); | 50 base::string16 c_title = base::SysNSStringToUTF16(title); |
| 47 _bookmarkModel->SetTitle(node, c_title); | 51 _bookmarkModel->SetTitle(node, c_title); |
| 48 } | 52 } |
| OLD | NEW |