| 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_expanded_state_tracker.h" | 5 #include "chrome/browser/bookmarks/bookmark_expanded_state_tracker.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/bookmarks/bookmark_model.h" | 8 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 10 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
| 11 #include "chrome/test/base/ui_test_utils.h" | 11 #include "chrome/test/base/ui_test_utils.h" |
| 12 #include "content/public/test/test_browser_thread.h" | 12 #include "content/public/test/test_browser_thread.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 using content::BrowserThread; | 15 using content::BrowserThread; |
| 16 | 16 |
| 17 class BookmarkExpandedStateTrackerTest : public testing::Test { | 17 class BookmarkExpandedStateTrackerTest : public testing::Test { |
| 18 public: | 18 public: |
| 19 BookmarkExpandedStateTrackerTest(); | 19 BookmarkExpandedStateTrackerTest(); |
| 20 | 20 |
| 21 virtual void SetUp() OVERRIDE; | 21 virtual void SetUp() OVERRIDE; |
| 22 virtual void TearDown() OVERRIDE; | 22 virtual void TearDown() OVERRIDE; |
| 23 | 23 |
| 24 protected: | 24 protected: |
| 25 BookmarkModel* GetModel(); | 25 BookmarkModel* GetModel(); |
| 26 | 26 |
| 27 private: | 27 private: |
| 28 scoped_ptr<TestingProfile> profile_; | 28 scoped_ptr<TestingProfile> profile_; |
| 29 MessageLoopForUI message_loop_; | 29 base::MessageLoopForUI message_loop_; |
| 30 content::TestBrowserThread ui_thread_; | 30 content::TestBrowserThread ui_thread_; |
| 31 content::TestBrowserThread file_thread_; | 31 content::TestBrowserThread file_thread_; |
| 32 | 32 |
| 33 DISALLOW_COPY_AND_ASSIGN(BookmarkExpandedStateTrackerTest); | 33 DISALLOW_COPY_AND_ASSIGN(BookmarkExpandedStateTrackerTest); |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 BookmarkExpandedStateTrackerTest::BookmarkExpandedStateTrackerTest() | 36 BookmarkExpandedStateTrackerTest::BookmarkExpandedStateTrackerTest() |
| 37 : ui_thread_(BrowserThread::UI, &message_loop_), | 37 : ui_thread_(BrowserThread::UI, &message_loop_), |
| 38 file_thread_(BrowserThread::FILE, &message_loop_) { | 38 file_thread_(BrowserThread::FILE, &message_loop_) { |
| 39 } | 39 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 BookmarkExpandedStateTracker::Nodes nodes; | 89 BookmarkExpandedStateTracker::Nodes nodes; |
| 90 nodes.insert(n1); | 90 nodes.insert(n1); |
| 91 tracker->SetExpandedNodes(nodes); | 91 tracker->SetExpandedNodes(nodes); |
| 92 // Verify that the node is present. | 92 // Verify that the node is present. |
| 93 EXPECT_EQ(nodes, tracker->GetExpandedNodes()); | 93 EXPECT_EQ(nodes, tracker->GetExpandedNodes()); |
| 94 // Call remove all. | 94 // Call remove all. |
| 95 model->RemoveAll(); | 95 model->RemoveAll(); |
| 96 // Verify node is not present. | 96 // Verify node is not present. |
| 97 EXPECT_TRUE(tracker->GetExpandedNodes().empty()); | 97 EXPECT_TRUE(tracker->GetExpandedNodes().empty()); |
| 98 } | 98 } |
| OLD | NEW |