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

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_context_menu_unittest.cc

Issue 219743002: x11: Move X event handling out of the message-pump. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge-r261267 Created 6 years, 8 months 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/views/bookmarks/bookmark_context_menu.h" 5 #include "chrome/browser/ui/views/bookmarks/bookmark_context_menu.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "base/threading/sequenced_worker_pool.h" 13 #include "base/threading/sequenced_worker_pool.h"
14 #include "chrome/app/chrome_command_ids.h" 14 #include "chrome/app/chrome_command_ids.h"
15 #include "chrome/browser/bookmarks/bookmark_model.h" 15 #include "chrome/browser/bookmarks/bookmark_model.h"
16 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 16 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
17 #include "chrome/browser/bookmarks/bookmark_test_helpers.h" 17 #include "chrome/browser/bookmarks/bookmark_test_helpers.h"
18 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" 19 #include "chrome/browser/ui/bookmarks/bookmark_utils.h"
20 #include "chrome/test/base/testing_profile.h" 20 #include "chrome/test/base/testing_profile.h"
21 #include "content/public/browser/page_navigator.h" 21 #include "content/public/browser/page_navigator.h"
22 #include "content/public/test/test_browser_thread.h" 22 #include "content/public/test/test_browser_thread.h"
23 #include "grit/generated_resources.h" 23 #include "grit/generated_resources.h"
24 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
25 #include "ui/base/clipboard/clipboard.h" 25 #include "ui/base/clipboard/clipboard.h"
26 #include "ui/events/platform/platform_event_source.h"
26 27
27 #if defined(OS_WIN) 28 #if defined(OS_WIN)
28 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" 29 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h"
29 #endif 30 #endif
30 31
31 using base::ASCIIToUTF16; 32 using base::ASCIIToUTF16;
32 using content::BrowserThread; 33 using content::BrowserThread;
33 using content::OpenURLParams; 34 using content::OpenURLParams;
34 using content::PageNavigator; 35 using content::PageNavigator;
35 using content::WebContents; 36 using content::WebContents;
(...skipping 15 matching lines...) Expand all
51 52
52 class BookmarkContextMenuTest : public testing::Test { 53 class BookmarkContextMenuTest : public testing::Test {
53 public: 54 public:
54 BookmarkContextMenuTest() 55 BookmarkContextMenuTest()
55 : ui_thread_(BrowserThread::UI, &message_loop_), 56 : ui_thread_(BrowserThread::UI, &message_loop_),
56 file_thread_(BrowserThread::FILE, &message_loop_), 57 file_thread_(BrowserThread::FILE, &message_loop_),
57 model_(NULL) { 58 model_(NULL) {
58 } 59 }
59 60
60 virtual void SetUp() OVERRIDE { 61 virtual void SetUp() OVERRIDE {
62 event_source_ = ui::PlatformEventSource::CreateDefault();
61 profile_.reset(new TestingProfile()); 63 profile_.reset(new TestingProfile());
62 profile_->CreateBookmarkModel(true); 64 profile_->CreateBookmarkModel(true);
63 65
64 model_ = BookmarkModelFactory::GetForProfile(profile_.get()); 66 model_ = BookmarkModelFactory::GetForProfile(profile_.get());
65 test::WaitForBookmarkModelToLoad(model_); 67 test::WaitForBookmarkModelToLoad(model_);
66 68
67 AddTestData(); 69 AddTestData();
68 } 70 }
69 71
70 virtual void TearDown() OVERRIDE { 72 virtual void TearDown() OVERRIDE {
71 ui::Clipboard::DestroyClipboardForCurrentThread(); 73 ui::Clipboard::DestroyClipboardForCurrentThread();
72 74
73 BrowserThread::GetBlockingPool()->FlushForTesting(); 75 BrowserThread::GetBlockingPool()->FlushForTesting();
74 // Flush the message loop to make application verifiers happy. 76 // Flush the message loop to make application verifiers happy.
75 message_loop_.RunUntilIdle(); 77 message_loop_.RunUntilIdle();
78 event_source_.reset();
76 } 79 }
77 80
78 protected: 81 protected:
79 base::MessageLoopForUI message_loop_; 82 base::MessageLoopForUI message_loop_;
80 content::TestBrowserThread ui_thread_; 83 content::TestBrowserThread ui_thread_;
81 content::TestBrowserThread file_thread_; 84 content::TestBrowserThread file_thread_;
85 scoped_ptr<ui::PlatformEventSource> event_source_;
82 scoped_ptr<TestingProfile> profile_; 86 scoped_ptr<TestingProfile> profile_;
83 BookmarkModel* model_; 87 BookmarkModel* model_;
84 TestingPageNavigator navigator_; 88 TestingPageNavigator navigator_;
85 89
86 private: 90 private:
87 // Creates the following structure: 91 // Creates the following structure:
88 // a 92 // a
89 // F1 93 // F1
90 // f1a 94 // f1a
91 // -f1b as "chrome://settings" 95 // -f1b as "chrome://settings"
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 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());
323 327
324 controller.reset(new BookmarkContextMenu( 328 controller.reset(new BookmarkContextMenu(
325 NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes, false)); 329 NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes, false));
326 // Cut the URL. 330 // Cut the URL.
327 controller->ExecuteCommand(IDC_CUT, 0); 331 controller->ExecuteCommand(IDC_CUT, 0);
328 ASSERT_TRUE(bb_node->GetChild(0)->is_url()); 332 ASSERT_TRUE(bb_node->GetChild(0)->is_url());
329 ASSERT_TRUE(bb_node->GetChild(1)->is_folder()); 333 ASSERT_TRUE(bb_node->GetChild(1)->is_folder());
330 ASSERT_EQ(old_count, bb_node->child_count()); 334 ASSERT_EQ(old_count, bb_node->child_count());
331 } 335 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/global_shortcut_listener_x11.cc ('k') | mojo/services/native_viewport/native_viewport_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698