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

Side by Side Diff: chrome/browser/bookmarks/bookmark_context_menu_controller_unittest.cc

Issue 8416009: Enable BookmarkContextMenuControllerTest.CutCopyPasteNode for aura builds. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/bookmarks/bookmark_context_menu_controller.h" 10 #include "chrome/browser/bookmarks/bookmark_context_menu_controller.h"
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_OPEN_ALL_NEW_WINDOW)); 281 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_OPEN_ALL_NEW_WINDOW));
282 EXPECT_FALSE( 282 EXPECT_FALSE(
283 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_OPEN_ALL_INCOGNITO)); 283 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_OPEN_ALL_INCOGNITO));
284 EXPECT_FALSE(controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_REMOVE)); 284 EXPECT_FALSE(controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_REMOVE));
285 EXPECT_FALSE( 285 EXPECT_FALSE(
286 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_ADD_NEW_BOOKMARK)); 286 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_ADD_NEW_BOOKMARK));
287 EXPECT_FALSE( 287 EXPECT_FALSE(
288 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_NEW_FOLDER)); 288 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_NEW_FOLDER));
289 } 289 }
290 290
291 // Fails on Linux Aura, probably because clipboard isn't built yet. 291 TEST_F(BookmarkContextMenuControllerTest, CutCopyPasteNode) {
292 // See http://crbug.com/100347
293 #if defined(USE_AURA) && !defined(OS_WIN)
294 #define MAYBE_CutCopyPasteNode FAILS_CutCopyPasteNode
295 #else
296 #define MAYBE_CutCopyPasteNode CutCopyPasteNode
297 #endif
298 TEST_F(BookmarkContextMenuControllerTest, MAYBE_CutCopyPasteNode) {
299 const BookmarkNode* bb_node = model_->bookmark_bar_node(); 292 const BookmarkNode* bb_node = model_->bookmark_bar_node();
300 std::vector<const BookmarkNode*> nodes; 293 std::vector<const BookmarkNode*> nodes;
301 nodes.push_back(bb_node->GetChild(0)); 294 nodes.push_back(bb_node->GetChild(0));
302 scoped_ptr<BookmarkContextMenuController> controller( 295 scoped_ptr<BookmarkContextMenuController> controller(
303 new BookmarkContextMenuController( 296 new BookmarkContextMenuController(
304 NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes)); 297 NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes));
305 EXPECT_TRUE(controller->IsCommandIdEnabled(IDC_COPY)); 298 EXPECT_TRUE(controller->IsCommandIdEnabled(IDC_COPY));
306 EXPECT_TRUE(controller->IsCommandIdEnabled(IDC_CUT)); 299 EXPECT_TRUE(controller->IsCommandIdEnabled(IDC_CUT));
307 300
308 // Copy the URL. 301 // Copy the URL.
309 controller->ExecuteCommand(IDC_COPY); 302 controller->ExecuteCommand(IDC_COPY);
310 303
311 controller.reset(new BookmarkContextMenuController( 304 controller.reset(new BookmarkContextMenuController(
312 NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes)); 305 NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes));
313 int old_count = bb_node->child_count(); 306 int old_count = bb_node->child_count();
314 controller->ExecuteCommand(IDC_PASTE); 307 controller->ExecuteCommand(IDC_PASTE);
315 308
316 ASSERT_TRUE(bb_node->GetChild(1)->is_url()); 309 ASSERT_TRUE(bb_node->GetChild(1)->is_url());
317 ASSERT_EQ(old_count + 1, bb_node->child_count()); 310 ASSERT_EQ(old_count + 1, bb_node->child_count());
318 ASSERT_EQ(bb_node->GetChild(0)->url(), bb_node->GetChild(1)->url()); 311 ASSERT_EQ(bb_node->GetChild(0)->url(), bb_node->GetChild(1)->url());
319 312
320 controller.reset(new BookmarkContextMenuController( 313 controller.reset(new BookmarkContextMenuController(
321 NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes)); 314 NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes));
322 // Cut the URL. 315 // Cut the URL.
323 controller->ExecuteCommand(IDC_CUT); 316 controller->ExecuteCommand(IDC_CUT);
324 ASSERT_TRUE(bb_node->GetChild(0)->is_url()); 317 ASSERT_TRUE(bb_node->GetChild(0)->is_url());
325 ASSERT_TRUE(bb_node->GetChild(1)->is_folder()); 318 ASSERT_TRUE(bb_node->GetChild(1)->is_folder());
326 ASSERT_EQ(old_count, bb_node->child_count()); 319 ASSERT_EQ(old_count, bb_node->child_count());
327 } 320 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698