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

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

Issue 10911074: Change how ui::Clipboard is accessed so there's only one per thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: views_delegate.h deletion Created 8 years, 3 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 (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/bookmarks/bookmark_utils.h" 5 #include "chrome/browser/bookmarks/bookmark_utils.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/bookmarks/bookmark_model.h" 9 #include "chrome/browser/bookmarks/bookmark_model.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "ui/base/clipboard/scoped_clipboard_writer.h" 11 #include "ui/base/clipboard/scoped_clipboard_writer.h"
12 12
13 #if !defined(OS_MACOSX) 13 #if !defined(OS_MACOSX)
14 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
15 #endif 15 #endif
kaiwang 2012/09/06 22:11:47 remove include?
16 16
17 using std::string; 17 using std::string;
18 18
19 namespace bookmark_utils { 19 namespace bookmark_utils {
20 namespace { 20 namespace {
21 21
22 TEST(BookmarkUtilsTest, GetBookmarksContainingText) { 22 TEST(BookmarkUtilsTest, GetBookmarksContainingText) {
23 BookmarkModel model(NULL); 23 BookmarkModel model(NULL);
24 const BookmarkNode* n1 = model.AddURL(model.other_node(), 24 const BookmarkNode* n1 = model.AddURL(model.other_node(),
25 0, 25 0,
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 // Copy a node to the clipboard. 135 // Copy a node to the clipboard.
136 std::vector<const BookmarkNode*> nodes; 136 std::vector<const BookmarkNode*> nodes;
137 nodes.push_back(node); 137 nodes.push_back(node);
138 CopyToClipboard(&model, nodes, false); 138 CopyToClipboard(&model, nodes, false);
139 139
140 // And make sure we can paste a bookmark from the clipboard. 140 // And make sure we can paste a bookmark from the clipboard.
141 EXPECT_TRUE(CanPasteFromClipboard(model.bookmark_bar_node())); 141 EXPECT_TRUE(CanPasteFromClipboard(model.bookmark_bar_node()));
142 142
143 // Write some text to the clipboard. 143 // Write some text to the clipboard.
144 { 144 {
145 ui::ScopedClipboardWriter clipboard_writer(g_browser_process->clipboard(), 145 ui::ScopedClipboardWriter clipboard_writer(
146 ui::Clipboard::BUFFER_STANDARD); 146 ui::Clipboard::GetForCurrentThread(),
147 ui::Clipboard::BUFFER_STANDARD);
147 clipboard_writer.WriteText(ASCIIToUTF16("foo")); 148 clipboard_writer.WriteText(ASCIIToUTF16("foo"));
148 } 149 }
149 150
150 // Now we shouldn't be able to paste from the clipboard. 151 // Now we shouldn't be able to paste from the clipboard.
151 EXPECT_FALSE(CanPasteFromClipboard(model.bookmark_bar_node())); 152 EXPECT_FALSE(CanPasteFromClipboard(model.bookmark_bar_node()));
152 } 153 }
153 #endif 154 #endif
154 155
155 } // namespace 156 } // namespace
156 } // namespace bookmark_utils 157 } // namespace bookmark_utils
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698