| 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/ui/bookmarks/bookmark_context_menu_controller.h" | 5 #include "chrome/browser/ui/bookmarks/bookmark_context_menu_controller.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "chrome/app/chrome_command_ids.h" | 12 #include "chrome/app/chrome_command_ids.h" |
| 13 #include "chrome/browser/bookmarks/bookmark_model.h" | 13 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 14 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 14 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 15 #include "chrome/browser/bookmarks/bookmark_test_helpers.h" | 15 #include "chrome/browser/bookmarks/bookmark_test_helpers.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" | 17 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" |
| 18 #include "chrome/test/base/testing_profile.h" | 18 #include "chrome/test/base/testing_profile.h" |
| 19 #include "content/public/browser/page_navigator.h" | 19 #include "content/public/browser/page_navigator.h" |
| 20 #include "content/public/test/test_browser_thread.h" | 20 #include "content/public/test/test_browser_thread.h" |
| 21 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
| 22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 23 #include "ui/base/clipboard/clipboard.h" | 23 #include "ui/base/clipboard/clipboard.h" |
| 24 | 24 |
| 25 using base::ASCIIToUTF16; |
| 25 using content::BrowserThread; | 26 using content::BrowserThread; |
| 26 using content::OpenURLParams; | 27 using content::OpenURLParams; |
| 27 using content::PageNavigator; | 28 using content::PageNavigator; |
| 28 using content::WebContents; | 29 using content::WebContents; |
| 29 | 30 |
| 30 // PageNavigator implementation that records the URL. | 31 // PageNavigator implementation that records the URL. |
| 31 class TestingPageNavigator : public PageNavigator { | 32 class TestingPageNavigator : public PageNavigator { |
| 32 public: | 33 public: |
| 33 virtual WebContents* OpenURL(const OpenURLParams& params) OVERRIDE { | 34 virtual WebContents* OpenURL(const OpenURLParams& params) OVERRIDE { |
| 34 urls_.push_back(params.url); | 35 urls_.push_back(params.url); |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 ASSERT_EQ(bb_node->GetChild(0)->url(), bb_node->GetChild(1)->url()); | 326 ASSERT_EQ(bb_node->GetChild(0)->url(), bb_node->GetChild(1)->url()); |
| 326 | 327 |
| 327 controller.reset(new BookmarkContextMenuController( | 328 controller.reset(new BookmarkContextMenuController( |
| 328 NULL, NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes)); | 329 NULL, NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes)); |
| 329 // Cut the URL. | 330 // Cut the URL. |
| 330 controller->ExecuteCommand(IDC_CUT, 0); | 331 controller->ExecuteCommand(IDC_CUT, 0); |
| 331 ASSERT_TRUE(bb_node->GetChild(0)->is_url()); | 332 ASSERT_TRUE(bb_node->GetChild(0)->is_url()); |
| 332 ASSERT_TRUE(bb_node->GetChild(1)->is_folder()); | 333 ASSERT_TRUE(bb_node->GetChild(1)->is_folder()); |
| 333 ASSERT_EQ(old_count, bb_node->child_count()); | 334 ASSERT_EQ(old_count, bb_node->child_count()); |
| 334 } | 335 } |
| OLD | NEW |