Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Side by Side Diff: chrome/browser/gtk/bookmark_editor_gtk_unittest.cc

Issue 342068: Third patch in getting rid of caching MessageLoop pointers and always using C... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <gtk/gtk.h> 5 #include <gtk/gtk.h>
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "chrome/browser/bookmarks/bookmark_model.h" 8 #include "chrome/browser/bookmarks/bookmark_model.h"
9 #include "chrome/browser/chrome_thread.h"
9 #include "chrome/browser/profile.h" 10 #include "chrome/browser/profile.h"
10 #include "chrome/browser/gtk/bookmark_editor_gtk.h" 11 #include "chrome/browser/gtk/bookmark_editor_gtk.h"
11 #include "chrome/browser/gtk/bookmark_tree_model.h" 12 #include "chrome/browser/gtk/bookmark_tree_model.h"
12 #include "chrome/common/pref_names.h" 13 #include "chrome/common/pref_names.h"
13 #include "chrome/common/pref_service.h" 14 #include "chrome/common/pref_service.h"
14 #include "chrome/test/testing_profile.h" 15 #include "chrome/test/testing_profile.h"
15 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
16 17
17 using base::Time; 18 using base::Time;
18 using base::TimeDelta; 19 using base::TimeDelta;
19 using bookmark_utils::GetTitleFromTreeIter; 20 using bookmark_utils::GetTitleFromTreeIter;
20 21
21 // Base class for bookmark editor tests. This class is a copy from 22 // Base class for bookmark editor tests. This class is a copy from
22 // bookmark_editor_view_unittest.cc, and all the tests in this file are 23 // bookmark_editor_view_unittest.cc, and all the tests in this file are
23 // GTK-ifications of the corresponding views tests. Testing here is really 24 // GTK-ifications of the corresponding views tests. Testing here is really
24 // important because on Linux, we make round trip copies from chrome's 25 // important because on Linux, we make round trip copies from chrome's
25 // BookmarkModel class to GTK's native GtkTreeStore. 26 // BookmarkModel class to GTK's native GtkTreeStore.
26 class BookmarkEditorGtkTest : public testing::Test { 27 class BookmarkEditorGtkTest : public testing::Test {
27 public: 28 public:
28 BookmarkEditorGtkTest() : model_(NULL) { 29 BookmarkEditorGtkTest()
30 : ui_thread_(ChromeThread::UI, &message_loop_),
31 file_thread_(ChromeThread::FILE, &message_loop_),
32 model_(NULL) {
29 } 33 }
30 34
31 virtual void SetUp() { 35 virtual void SetUp() {
32 profile_.reset(new TestingProfile()); 36 profile_.reset(new TestingProfile());
33 profile_->set_has_history_service(true); 37 profile_->set_has_history_service(true);
34 profile_->CreateBookmarkModel(true); 38 profile_->CreateBookmarkModel(true);
39 profile_->BlockUntilBookmarkModelLoaded();
35 40
36 model_ = profile_->GetBookmarkModel(); 41 model_ = profile_->GetBookmarkModel();
37 42
38 AddTestData(); 43 AddTestData();
39 } 44 }
40 45
41 virtual void TearDown() { 46 virtual void TearDown() {
42 } 47 }
43 48
44 protected: 49 protected:
45 MessageLoopForUI message_loop_; 50 MessageLoopForUI message_loop_;
51 ChromeThread ui_thread_;
52 ChromeThread file_thread_;
46 BookmarkModel* model_; 53 BookmarkModel* model_;
47 scoped_ptr<TestingProfile> profile_; 54 scoped_ptr<TestingProfile> profile_;
48 55
49 std::string base_path() const { return "file:///c:/tmp/"; } 56 std::string base_path() const { return "file:///c:/tmp/"; }
50 57
51 const BookmarkNode* GetNode(const std::string& name) { 58 const BookmarkNode* GetNode(const std::string& name) {
52 return model_->GetMostRecentlyAddedNodeForURL(GURL(base_path() + name)); 59 return model_->GetMostRecentlyAddedNodeForURL(GURL(base_path() + name));
53 } 60 }
54 61
55 private: 62 private:
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 gtk_entry_set_text(GTK_ENTRY(editor.name_entry_), "new_a"); 317 gtk_entry_set_text(GTK_ENTRY(editor.name_entry_), "new_a");
311 318
312 editor.ApplyEdits(); 319 editor.ApplyEdits();
313 320
314 const BookmarkNode* other_node = profile_->GetBookmarkModel()->other_node(); 321 const BookmarkNode* other_node = profile_->GetBookmarkModel()->other_node();
315 ASSERT_EQ(2, other_node->GetChildCount()); 322 ASSERT_EQ(2, other_node->GetChildCount());
316 323
317 const BookmarkNode* new_node = other_node->GetChild(0); 324 const BookmarkNode* new_node = other_node->GetChild(0);
318 EXPECT_EQ(L"new_a", new_node->GetTitle()); 325 EXPECT_EQ(L"new_a", new_node->GetTitle());
319 } 326 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/bookmark_bar_gtk_unittest.cc ('k') | chrome/browser/gtk/bookmark_manager_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698