Commit 631b4d24 authored by David Bienvenu's avatar David Bienvenu Committed by Commit Bot

Make BookmarkContextMenuTest and BookmarkContextMenuControllerTest use test clipboard.

Unit tests shouldn't use system clipboard because clipboard is a global resource.

Bug: 963112
Change-Id: I2c32042dac0aee6f91418b5f7b8099c018aef55a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1625942
Commit-Queue: David Bienvenu <davidbienvenu@chromium.org>
Reviewed-by: default avatarMichael Wasserman <msw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#663132}
parent ee8d0c64
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "content/public/test/test_browser_thread_bundle.h" #include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/clipboard/clipboard.h" #include "ui/base/clipboard/clipboard.h"
#include "ui/base/clipboard/test/test_clipboard.h"
using base::ASCIIToUTF16; using base::ASCIIToUTF16;
using bookmarks::BookmarkModel; using bookmarks::BookmarkModel;
...@@ -58,6 +59,8 @@ class BookmarkContextMenuControllerTest : public testing::Test { ...@@ -58,6 +59,8 @@ class BookmarkContextMenuControllerTest : public testing::Test {
model_ = BookmarkModelFactory::GetForBrowserContext(profile_.get()); model_ = BookmarkModelFactory::GetForBrowserContext(profile_.get());
bookmarks::test::WaitForBookmarkModelToLoad(model_); bookmarks::test::WaitForBookmarkModelToLoad(model_);
AddTestData(model_); AddTestData(model_);
// CutCopyPasteNode executes IDC_CUT and IDC_COPY commands.
ui::TestClipboard::CreateForCurrentThread();
} }
void TearDown() override { void TearDown() override {
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "content/public/test/test_browser_thread_bundle.h" #include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/clipboard/clipboard.h" #include "ui/base/clipboard/clipboard.h"
#include "ui/base/clipboard/test/test_clipboard.h"
#include "ui/events/platform/platform_event_source.h" #include "ui/events/platform/platform_event_source.h"
#include "ui/views/controls/menu/menu_item_view.h" #include "ui/views/controls/menu/menu_item_view.h"
...@@ -74,6 +75,8 @@ class BookmarkContextMenuTest : public testing::Test { ...@@ -74,6 +75,8 @@ class BookmarkContextMenuTest : public testing::Test {
bookmarks::test::WaitForBookmarkModelToLoad(model_); bookmarks::test::WaitForBookmarkModelToLoad(model_);
AddTestData(); AddTestData();
// CutCopyPasteNode executes IDC_COPY and IDC_CUT commands.
ui::TestClipboard::CreateForCurrentThread();
} }
void TearDown() override { void TearDown() override {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment