| 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 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/app/chrome_command_ids.h" | 11 #include "chrome/app/chrome_command_ids.h" |
| 12 #include "chrome/browser/bookmarks/bookmark_model.h" | 12 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 13 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 13 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 14 #include "chrome/browser/bookmarks/bookmark_utils.h" | 14 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/ui/views/bookmarks/bookmark_context_menu.h" | 16 #include "chrome/browser/ui/views/bookmarks/bookmark_context_menu.h" |
| 17 #include "chrome/test/base/testing_profile.h" | 17 #include "chrome/test/base/testing_profile.h" |
| 18 #include "content/public/browser/page_navigator.h" | 18 #include "content/public/browser/page_navigator.h" |
| 19 #include "content/public/test/test_browser_thread.h" | 19 #include "content/public/test/test_browser_thread.h" |
| 20 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
| 21 #include "ui/base/clipboard/clipboard.h" |
| 21 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 22 | 23 |
| 23 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
| 24 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" | 25 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" |
| 25 #endif | 26 #endif |
| 26 | 27 |
| 27 using content::BrowserThread; | 28 using content::BrowserThread; |
| 28 using content::OpenURLParams; | 29 using content::OpenURLParams; |
| 29 using content::PageNavigator; | 30 using content::PageNavigator; |
| 30 using content::WebContents; | 31 using content::WebContents; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 model_ = BookmarkModelFactory::GetForProfile(profile_.get()); | 65 model_ = BookmarkModelFactory::GetForProfile(profile_.get()); |
| 65 | 66 |
| 66 AddTestData(); | 67 AddTestData(); |
| 67 } | 68 } |
| 68 | 69 |
| 69 virtual void TearDown() { | 70 virtual void TearDown() { |
| 70 #if defined(OS_WIN) | 71 #if defined(OS_WIN) |
| 71 bookmark_utils::DisableBookmarkBarViewAnimationsForTesting(false); | 72 bookmark_utils::DisableBookmarkBarViewAnimationsForTesting(false); |
| 72 #endif | 73 #endif |
| 73 | 74 |
| 75 ui::Clipboard::DestroyClipboardForCurrentThread(); |
| 76 |
| 74 // Flush the message loop to make application verifiers happy. | 77 // Flush the message loop to make application verifiers happy. |
| 75 message_loop_.RunAllPending(); | 78 message_loop_.RunAllPending(); |
| 76 } | 79 } |
| 77 | 80 |
| 78 protected: | 81 protected: |
| 79 MessageLoopForUI message_loop_; | 82 MessageLoopForUI message_loop_; |
| 80 content::TestBrowserThread ui_thread_; | 83 content::TestBrowserThread ui_thread_; |
| 81 content::TestBrowserThread file_thread_; | 84 content::TestBrowserThread file_thread_; |
| 82 scoped_ptr<TestingProfile> profile_; | 85 scoped_ptr<TestingProfile> profile_; |
| 83 BookmarkModel* model_; | 86 BookmarkModel* model_; |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 ASSERT_EQ(bb_node->GetChild(0)->url(), bb_node->GetChild(1)->url()); | 310 ASSERT_EQ(bb_node->GetChild(0)->url(), bb_node->GetChild(1)->url()); |
| 308 | 311 |
| 309 controller.reset(new BookmarkContextMenu( | 312 controller.reset(new BookmarkContextMenu( |
| 310 NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes, false)); | 313 NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes, false)); |
| 311 // Cut the URL. | 314 // Cut the URL. |
| 312 controller->ExecuteCommand(IDC_CUT); | 315 controller->ExecuteCommand(IDC_CUT); |
| 313 ASSERT_TRUE(bb_node->GetChild(0)->is_url()); | 316 ASSERT_TRUE(bb_node->GetChild(0)->is_url()); |
| 314 ASSERT_TRUE(bb_node->GetChild(1)->is_folder()); | 317 ASSERT_TRUE(bb_node->GetChild(1)->is_folder()); |
| 315 ASSERT_EQ(old_count, bb_node->child_count()); | 318 ASSERT_EQ(old_count, bb_node->child_count()); |
| 316 } | 319 } |
| OLD | NEW |