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

Unified Diff: content/common/sandbox_mac_system_access_unittest.mm

Issue 1852433004: Fix NSPasteboard leaks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile error. Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: content/common/sandbox_mac_system_access_unittest.mm
diff --git a/content/common/sandbox_mac_system_access_unittest.mm b/content/common/sandbox_mac_system_access_unittest.mm
index 029807156094faee925d854a24c277a2933648e2..b37b967d2b932130a0227e5a30c68e70c605e38b 100644
--- a/content/common/sandbox_mac_system_access_unittest.mm
+++ b/content/common/sandbox_mac_system_access_unittest.mm
@@ -9,11 +9,13 @@
#include "base/files/file_util.h"
#include "base/files/scoped_file.h"
#include "base/logging.h"
+#include "base/memory/ref_counted.h"
#include "base/strings/sys_string_conversions.h"
#include "content/common/sandbox_mac.h"
#include "content/common/sandbox_mac_unittest_helper.h"
#include "crypto/openssl_util.h"
#include "testing/gtest/include/gtest/gtest.h"
+#import "ui/base/clipboard/clipboard_util_mac.h"
namespace content {
@@ -69,15 +71,16 @@ void MacSandboxedClipboardTestCase::SetTestData(const char* test_data) {
}
TEST_F(MacSandboxTest, ClipboardAccess) {
- NSPasteboard* pb = [NSPasteboard pasteboardWithUniqueName];
- EXPECT_EQ([[pb types] count], 0U);
+ scoped_refptr<ui::UniquePasteboard> pb = new ui::UniquePasteboard;
+ ASSERT_TRUE(pb->get());
+ EXPECT_EQ([[pb->get() types] count], 0U);
- std::string pasteboard_name = base::SysNSStringToUTF8([pb name]);
+ std::string pasteboard_name = base::SysNSStringToUTF8([pb->get() name]);
EXPECT_TRUE(RunTestInAllSandboxTypes("MacSandboxedClipboardTestCase",
pasteboard_name.c_str()));
// After executing the test, the clipboard should still be empty.
- EXPECT_EQ([[pb types] count], 0U);
+ EXPECT_EQ([[pb->get() types] count], 0U);
}
//--------------------- File Access Sandboxing ----------------------
« no previous file with comments | « content/browser/web_contents/web_drag_source_mac_unittest.mm ('k') | ui/base/clipboard/clipboard_util_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698