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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/bookmarks/bookmark_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_model.h" |
11 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 11 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/views/bookmarks/bookmark_editor_view.h" | 13 #include "chrome/browser/ui/views/bookmarks/bookmark_editor_view.h" |
14 #include "chrome/test/base/testing_profile.h" | 14 #include "chrome/test/base/testing_profile.h" |
| 15 #include "chrome/test/base/ui_test_utils.h" |
15 #include "content/public/test/test_browser_thread.h" | 16 #include "content/public/test/test_browser_thread.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
17 | 18 |
18 using base::Time; | 19 using base::Time; |
19 using base::TimeDelta; | 20 using base::TimeDelta; |
20 using content::BrowserThread; | 21 using content::BrowserThread; |
21 | 22 |
22 // Base class for bookmark editor tests. Creates a BookmarkModel and populates | 23 // Base class for bookmark editor tests. Creates a BookmarkModel and populates |
23 // it with test data. | 24 // it with test data. |
24 class BookmarkEditorViewTest : public testing::Test { | 25 class BookmarkEditorViewTest : public testing::Test { |
25 public: | 26 public: |
26 BookmarkEditorViewTest() | 27 BookmarkEditorViewTest() |
27 : ui_thread_(BrowserThread::UI, &message_loop_), | 28 : ui_thread_(BrowserThread::UI, &message_loop_), |
28 file_thread_(BrowserThread::FILE, &message_loop_), | 29 file_thread_(BrowserThread::FILE, &message_loop_), |
29 model_(NULL) { | 30 model_(NULL) { |
30 } | 31 } |
31 | 32 |
32 virtual void SetUp() { | 33 virtual void SetUp() { |
33 profile_.reset(new TestingProfile()); | 34 profile_.reset(new TestingProfile()); |
34 profile_->CreateBookmarkModel(true); | 35 profile_->CreateBookmarkModel(true); |
35 | 36 |
36 model_ = BookmarkModelFactory::GetForProfile(profile_.get()); | 37 model_ = BookmarkModelFactory::GetForProfile(profile_.get()); |
37 profile_->BlockUntilBookmarkModelLoaded(); | 38 ui_test_utils::WaitForBookmarkModelToLoad(model_); |
38 | 39 |
39 AddTestData(); | 40 AddTestData(); |
40 } | 41 } |
41 | 42 |
42 virtual void TearDown() { | 43 virtual void TearDown() { |
43 } | 44 } |
44 | 45 |
45 protected: | 46 protected: |
46 std::string base_path() const { return "file:///c:/tmp/"; } | 47 std::string base_path() const { return "file:///c:/tmp/"; } |
47 | 48 |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 EXPECT_EQ(BookmarkNode::FOLDER, new_node->type()); | 380 EXPECT_EQ(BookmarkNode::FOLDER, new_node->type()); |
380 EXPECT_EQ(ASCIIToUTF16("new_F"), new_node->GetTitle()); | 381 EXPECT_EQ(ASCIIToUTF16("new_F"), new_node->GetTitle()); |
381 // The node should have one child. | 382 // The node should have one child. |
382 ASSERT_EQ(1, new_node->child_count()); | 383 ASSERT_EQ(1, new_node->child_count()); |
383 const BookmarkNode* new_child = new_node->GetChild(0); | 384 const BookmarkNode* new_child = new_node->GetChild(0); |
384 // Make sure the child url/title match. | 385 // Make sure the child url/title match. |
385 EXPECT_EQ(BookmarkNode::URL, new_child->type()); | 386 EXPECT_EQ(BookmarkNode::URL, new_child->type()); |
386 EXPECT_EQ(details.urls[0].second, new_child->GetTitle()); | 387 EXPECT_EQ(details.urls[0].second, new_child->GetTitle()); |
387 EXPECT_EQ(details.urls[0].first, new_child->url()); | 388 EXPECT_EQ(details.urls[0].first, new_child->url()); |
388 } | 389 } |
OLD | NEW |