| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/bookmarks/bookmark_html_writer.h" | 5 #include "chrome/browser/bookmarks/bookmark_html_writer.h" |
| 6 | 6 |
| 7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
| 8 #include "base/i18n/time_formatting.h" | 8 #include "base/i18n/time_formatting.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 base::FilePath path_; | 123 base::FilePath path_; |
| 124 }; | 124 }; |
| 125 | 125 |
| 126 // Class that will notify message loop when file is written. | 126 // Class that will notify message loop when file is written. |
| 127 class BookmarksObserver : public BookmarksExportObserver { | 127 class BookmarksObserver : public BookmarksExportObserver { |
| 128 public: | 128 public: |
| 129 explicit BookmarksObserver(base::RunLoop* loop) : loop_(loop) { | 129 explicit BookmarksObserver(base::RunLoop* loop) : loop_(loop) { |
| 130 DCHECK(loop); | 130 DCHECK(loop); |
| 131 } | 131 } |
| 132 | 132 |
| 133 virtual void OnExportFinished() override { | 133 void OnExportFinished() override { loop_->Quit(); } |
| 134 loop_->Quit(); | |
| 135 } | |
| 136 | 134 |
| 137 private: | 135 private: |
| 138 base::RunLoop* loop_; | 136 base::RunLoop* loop_; |
| 139 | 137 |
| 140 DISALLOW_COPY_AND_ASSIGN(BookmarksObserver); | 138 DISALLOW_COPY_AND_ASSIGN(BookmarksObserver); |
| 141 }; | 139 }; |
| 142 | 140 |
| 143 // Tests bookmark_html_writer by populating a BookmarkModel, writing it out by | 141 // Tests bookmark_html_writer by populating a BookmarkModel, writing it out by |
| 144 // way of bookmark_html_writer, then using the importer to read it back in. | 142 // way of bookmark_html_writer, then using the importer to read it back in. |
| 145 TEST_F(BookmarkHTMLWriterTest, Test) { | 143 TEST_F(BookmarkHTMLWriterTest, Test) { |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 AssertBookmarkEntryEquals(parsed_bookmarks[6], false, url1, url1_title, t1, | 283 AssertBookmarkEntryEquals(parsed_bookmarks[6], false, url1, url1_title, t1, |
| 286 f3_title, f4_title, base::string16()); | 284 f3_title, f4_title, base::string16()); |
| 287 AssertBookmarkEntryEquals(parsed_bookmarks[7], false, url1, url1_title, t1, | 285 AssertBookmarkEntryEquals(parsed_bookmarks[7], false, url1, url1_title, t1, |
| 288 base::string16(), base::string16(), | 286 base::string16(), base::string16(), |
| 289 base::string16()); | 287 base::string16()); |
| 290 AssertBookmarkEntryEquals(parsed_bookmarks[8], false, unnamed_bookmark_url, | 288 AssertBookmarkEntryEquals(parsed_bookmarks[8], false, unnamed_bookmark_url, |
| 291 unnamed_bookmark_title, t2, | 289 unnamed_bookmark_title, t2, |
| 292 base::string16(), base::string16(), | 290 base::string16(), base::string16(), |
| 293 base::string16()); | 291 base::string16()); |
| 294 } | 292 } |
| OLD | NEW |