electron/spec/api-clipboard-spec.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

156 строки
5.5 KiB
TypeScript
Исходник Обычный вид История

import { expect } from 'chai';
import * as path from 'node:path';
import { Buffer } from 'node:buffer';
import { ifdescribe, ifit } from './lib/spec-helpers';
import { clipboard, nativeImage } from 'electron/common';
2016-01-12 05:40:23 +03:00
chore: bump chromium to 93.0.4566.0 (main) (#29980) * chore: bump chromium in DEPS to 93.0.4562.0 * chore: update patches * [base] Made Value::Take{Dict,List}() rvalue ref-qualified. https://chromium-review.googlesource.com/c/chromium/src/+/2988105 * Revert "Reland "Roll src/buildtools/third_party/libc++/trunk/ 8fa879467..79a2e924d (426 commits)"" https://chromium-review.googlesource.com/c/chromium/src/+/2995482 This reverts commit 9691d6c265f010791c37d374248559969980ec65 and 797723ec838709ddeba0c104e30727ee0b7ac8ca * Pass gfx::Insets to GetHTComponentForFrame https://chromium-review.googlesource.com/c/chromium/src/+/2984243 * chore: bump chromium in DEPS to 93.0.4563.0 * [Clipboard API] Clipboard Custom Formats implementation Part 2. https://chromium-review.googlesource.com/c/chromium/src/+/2967649 * chore: update patches * chore: bump chromium in DEPS to 93.0.4564.0 * chore: bump chromium in DEPS to 93.0.4565.0 * chore: update patches * Prevent use of base::NoDestructor for trivially-destructible types https://chromium-review.googlesource.com/c/chromium/src/+/2998672 * chore: update patches * fixup! [Clipboard API] Clipboard Custom Formats implementation Part 2. * chore: bump chromium in DEPS to 93.0.4566.0 * chore: update patches * chore: add missing header * ci: do not run clipboard tests on WOA Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-07-06 15:17:13 +03:00
// FIXME(zcbenz): Clipboard tests are failing on WOA.
ifdescribe(process.platform !== 'win32' || process.arch !== 'arm64')('clipboard module', () => {
2017-10-27 03:12:51 +03:00
const fixtures = path.resolve(__dirname, 'fixtures');
2017-10-27 03:12:51 +03:00
describe('clipboard.readImage()', () => {
2017-10-27 05:09:38 +03:00
it('returns NativeImage instance', () => {
2017-10-27 03:12:51 +03:00
const p = path.join(fixtures, 'assets', 'logo.png');
const i = nativeImage.createFromPath(p);
clipboard.writeImage(i);
const readImage = clipboard.readImage();
expect(readImage.toDataURL()).to.equal(i.toDataURL());
2016-03-25 23:03:49 +03:00
});
it('works for empty image', () => {
clipboard.writeText('Not an Image');
expect(clipboard.readImage().isEmpty()).to.be.true();
});
2016-03-25 23:03:49 +03:00
});
2017-10-27 03:12:51 +03:00
describe('clipboard.readText()', () => {
it('returns unicode string correctly', () => {
const text = '千江有水千江月,万里无云万里天';
2016-03-25 23:03:49 +03:00
clipboard.writeText(text);
expect(clipboard.readText()).to.equal(text);
2016-03-25 23:03:49 +03:00
});
});
2017-10-27 03:12:51 +03:00
describe('clipboard.readHTML()', () => {
it('returns markup correctly', () => {
chore: bump chromium to 126.0.6445.0 (main) (#41868) * chore: bump chromium in DEPS to 125.0.6421.0 * chore: bump chromium in DEPS to 125.0.6422.0 * Add ENABLE_BASE_TRACING flags for compatibility with enable_base_tracing = false on Windows https://chromium-review.googlesource.com/c/chromium/src/+/5434658 * chore: update patches * fixup: Add ENABLE_BASE_TRACING flags for compatibility with enable_base_tracing = false on Windows * chore: bump chromium in DEPS to 126.0.6423.0 * chore: update patches * 5426599: Next generation control of unsafe-buffers-usage plugin https://chromium-review.googlesource.com/c/chromium/src/+/5426599 * chore: bump chromium in DEPS to 126.0.6425.0 * chore: update patches * Roll clang+rust llvmorg-19-init-7229-g315c88c5-2 : llvmorg-19-init-8091-gab037c4f-1 / ceab6128fa48a616bfd3e3adf4bc80133b8ee223-1 : ab71ee7a9214c2793108a41efb065aa77aeb7326-1 https://chromium-review.googlesource.com/c/chromium/src/+/5444328 Also see https://issues.chromium.org/issues/332931387 * 5445074: [Views AX] Move AXEventNotificationDetails to ui/accessibility/ https://chromium-review.googlesource.com/c/chromium/src/+/5445074 Also 5455993: [Views AX] Rename AXEventNotificationDetails to AXUpdatesAndEvents | https://chromium-review.googlesource.com/c/chromium/src/+/5455993 * Pass IsolationInfo to ContentBrowserClient::WillCreateURLLoaderFactory() https://chromium-review.googlesource.com/c/chromium/src/+/5405301 * chore: bump chromium in DEPS to 126.0.6427.0 * chore: update patches * chore: remove no longer needed patch perfetto is now turned on so this patch is no longer needed. * chore: bump chromium in DEPS to 126.0.6429.0 * chore: bump chromium in DEPS to 126.0.6431.0 * chore: bump chromium in DEPS to 126.0.6433.0 * 5466654: Do not create a console if logging to a handle https://chromium-review.googlesource.com/c/chromium/src/+/5466654 * chore: fixup patch indices * Address Linux NonClientFrameView Changes - https://chromium-review.googlesource.com/c/chromium/src/+/5180720 - https://chromium-review.googlesource.com/c/chromium/src/+/5367794 * chore: bump chromium in DEPS to 126.0.6435.0 * chore: bump chromium in DEPS to 126.0.6437.0 * chore: update patches * chore: bump chromium in DEPS to 126.0.6439.0 * chore: bump chromium in DEPS to 126.0.6441.0 * 5477689: components/crash/content/tools: Format with yapf | https://chromium-review.googlesource.com/c/chromium/src/+/5477689 * 5485006: Remove enable_print_content_analysis GN flag | https://chromium-review.googlesource.com/c/chromium/src/+/5485006 * chore: update chromium patches * chore: bump chromium in DEPS to 126.0.6443.0 * 5465608: Convert DCHECKs near RenderWidgetHost, DelegatedFrameHost to CHECK | https://chromium-review.googlesource.com/c/chromium/src/+/5465608 * 5492605: Migrate TODOs referencing old crbug IDs to the new issue tracker IDs | https://chromium-review.googlesource.com/c/chromium/src/+/5492605 * chore: update patches * chore: bump chromium in DEPS to 126.0.6445.0 * chore: update patches * 5468588: Fullscreen: Encapsulate ExclusiveAccessBubble params in a struct | https://chromium-review.googlesource.com/c/chromium/src/+/5468588 * fixup! 5485006: Remove enable_print_content_analysis GN flag | https://chromium-review.googlesource.com/c/chromium/src/+/5485006 * 5461340: `size_t` in `mojo::DataPipe[Consumer|Producer]Handle`: /components. | https://chromium-review.googlesource.com/c/chromium/src/+/5461340 * 5480213: Add an EvictIds struct to FrameEvictorClient | https://chromium-review.googlesource.com/c/chromium/src/+/5480213 * 4341506: [api] Deprecate Isolate::IdleNotificationDeadline | https://chromium-review.googlesource.com/c/v8/v8/+/4341506 * 5300826: [v8-tasks] Add source location to v8::TaskRunner, step 4/4. | https://chromium-review.googlesource.com/c/v8/v8/+/5300826 * partially revert is_newly_created to allow for browser initiated about:blank loads * add dep on app_launch_prefetch Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5420149 * install sysroots from electron not from chrome We should add a new var upstream for `download_sysroots` so that we can skip downloading chromes at all. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5462469 * refactor: make UpdateFrameHints an override Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5473548 * fix ppapi * refactor: update namespace for pwm switches Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5444617 * 5459367: WebSQL: Restrict WebSQL service creation to Android only | https://chromium-review.googlesource.com/c/chromium/src/+/5459367 * 5455853: Revert "[Clipboard] Don't add meta charset tag for async write() method on Mac." | https://chromium-review.googlesource.com/c/chromium/src/+/5455853 * fixup! refactor: update namespace for pwm switches edd9e26 Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5444617 * 5147611: [heap] Add checks for ensuring position info slow path is not used in heap snapshot | https://chromium-review.googlesource.com/c/v8/v8/+/5147611 * fixup! 5412666: [heap] Also avoid heap allocation for allocation tracked functions | https://chromium-review.googlesource.com/c/v8/v8/+/5412666 * chore: add websql removal to breaking-changes.md --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: VerteDinde <vertedinde@electronjs.org> Co-authored-by: Keeley Hammond <khammond@slack-corp.com> Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
2024-05-10 18:21:10 +03:00
let text = '<string>Hi</string>';
// CL: https://chromium-review.googlesource.com/c/chromium/src/+/5187335
if (process.platform === 'darwin') {
text = '<meta charset=\'utf-8\'><string>Hi</string>';
}
clipboard.writeHTML('<string>Hi</string>');
chore: bump chromium to 123.0.6296.0 (main) (#41204) * chore: bump chromium in DEPS to 123.0.6273.0 * chore: update patches * chore: bump chromium in DEPS to 123.0.6274.0 * chore: update patches * chore: bump chromium in DEPS to 123.0.6276.0 * chore: update patches * WIP: 5239586: Change View::Layout() to take a PassKey. https://chromium-review.googlesource.com/c/chromium/src/+/5239586 * WIP: 5239586: Change View::Layout() to take a PassKey. https://chromium-review.googlesource.com/c/chromium/src/+/5239586 * chore: bump chromium in DEPS to 123.0.6278.0 * chore: bump chromium in DEPS to 123.0.6280.0 * chore: update patches * chore: use net::CanonicalCookie::SecureAttribute() renamed from IsSecure() Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5245913 * refactor: handle multiple requested device ids Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5132210 * refactor: trigger View layouts async with View::InvalidateLayout() Upstream has introduced a PassKey to restrict who can call Layout() directly. I've opted for calling `InvalidateLayout()` which is the approach that upstream recommends. If for some reason this approach doesn't work for us, we could use `DeprecatedLayoutImmediately()` as a stopgap. Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5239586 Xref: https://chromium.googlesource.com/chromium/src/+/main/ui/views/view.h#809 Xref: https://chromium.googlesource.com/chromium/src/+/main/docs/ui/learn/bestpractices/layout.md?pli=1#don_t-invoke-layout_directly * chore: bump chromium in DEPS to 123.0.6282.0 * chore: bump chromium in DEPS to 123.0.6284.0 * chore: update patches * refactor: remove use of blink::MainThreadIsolate() pt 1/3 Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5249640 * refactor: remove use of blink::MainThreadIsolate() pt 2/3 Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5249640 * refactor: remove use of blink::MainThreadIsolate() pt 3/3 Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5249640 * chore: update enum name to ui::AXMode::kPDFPrinting Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5270301 * chore: rebuild filenames.libcxx.gni * chore: sync with upstream rename of PortProvider.TaskForHandle() Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5259103 * chore: bump chromium in DEPS to 123.0.6286.0 * chore: bump chromium in DEPS to 123.0.6288.0 * WebPreferences: Initialize in declaration. Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5277099 * chore: update webview_fullscreen.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5053508 Simple update to fix patch shear * chore: update feat_configure_launch_options_for_service_process.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5254861 Simple update to fix patch shear * chore: add IWC::Delegate::RecordResize() stub to fix FTBFS https://chromium-review.googlesource.com/c/chromium/src/+/5268963 * chore: add FormControlType::kButtonPopover to the FormControlType converter Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5230929 * chore: e patches all * chore: node script/gen-libc++-filenames.js * chore: bump chromium in DEPS to 123.0.6290.0 * chore: bump chromium in DEPS to 123.0.6291.0 * chore: bump chromium in DEPS to 123.0.6292.0 * chore: bump chromium in DEPS to 123.0.6294.0 * chore: update fix_aspect_ratio_with_max_size.patch Xref: fix_aspect_ratio_with_max_size.patch note: simple absl::optional -> std::optional conversion * chore: update feat_filter_out_non-shareable_windows_in_the_current_application_in.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5272337 * chore: update add_maximized_parameter_to_linuxui_getwindowframeprovider.patch No manual changes; just adjusting line patch offsets Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5258688 * chore: update feat_configure_launch_options_for_service_process.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5281322 * chore: update fix_select_The_first_menu_item_when_opened_via_keyboard.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5279376 note: simple absl::optional -> std::optional conversion * chore: update feat_allow_code_cache_in_custom_schemes.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5268792 * chore: script/export_all_patches.py * chore: bump chromium in DEPS to 123.0.6296.0 * chore: update patches * fixup! chore: update feat_allow_code_cache_in_custom_schemes.patch * fix: restore MessagePort close event * spec: fix CORB testing Refs https://chromium-review.googlesource.com/c/chromium/src/+/5231506 * fix: use sync layout when content view changes * fixup! chore: update feat_configure_launch_options_for_service_process.patch * Add remote-cocoa support for context menus. Refs https://chromium-review.googlesource.com/c/chromium/src/+/5259806 * Rename //net/base/mac directory to //net/base/apple (1/n) Refs https://chromium-review.googlesource.com/c/chromium/src/+/5211389 * fixup! Add remote-cocoa support for context menus. * [Clipboard] Don't add meta charset tag for async write() method on Mac. Refs https://chromium-review.googlesource.com/c/chromium/src/+/5187335 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: clavin <clavin@electronjs.org> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: deepak1556 <hop2deep@gmail.com>
2024-02-14 20:33:32 +03:00
expect(clipboard.readHTML()).to.equal(text);
2016-03-25 23:03:49 +03:00
});
});
2017-10-27 03:12:51 +03:00
describe('clipboard.readRTF', () => {
it('returns rtf text correctly', () => {
const rtf = '{\\rtf1\\ansi{\\fonttbl\\f0\\fswiss Helvetica;}\\f0\\pard\nThis is some {\\b bold} text.\\par\n}';
2016-05-27 00:23:50 +03:00
clipboard.writeRTF(rtf);
expect(clipboard.readRTF()).to.equal(rtf);
2016-03-25 23:03:49 +03:00
});
});
2021-10-26 15:14:08 +03:00
ifdescribe(process.platform !== 'linux')('clipboard.readBookmark', () => {
it('returns title and url', () => {
clipboard.writeBookmark('a title', 'https://electronjs.org');
chore: bump chromium to 95.0.4629.0 (main) (#30676) * chore: bump chromium in DEPS to 95.0.4620.0 * chore: update patches * 3076261: Move args_ to private in ExtensionFunction https://chromium-review.googlesource.com/c/chromium/src/+/3076261 * [GURL -> SiteForCookies] content/public/browser/content_browser_client.h https://chromium-review.googlesource.com/c/chromium/src/+/3107759 * chore: fix -Wunreachable-code-return in node * Tracing to diagnose ContentScriptTracker-related bad message reports https://chromium-review.googlesource.com/c/chromium/src/+/3057922 * chore: bump chromium in DEPS to 95.0.4621.0 * chore: update patches * Remove title from the URL format on Windows. https://chromium-review.googlesource.com/c/chromium/src/+/3108445 * chore: bump chromium in DEPS to 95.0.4623.0 * Revert "chore: disable v8 oilpan" This reverts commit 5d255cf1d8e8efbb906047937a713279e5f800d0. (cherry picked from commit ba5cde4da2428020d99b7fb603c702878f95da78) * Change file paths in network context params to be relative. https://chromium-review.googlesource.com/c/chromium/src/+/3092927 * Code Health: Rename/replace content::WebUI::RegisterMessageCallback(). https://chromium-review.googlesource.com/c/chromium/src/+/3104691 * Migrate CanExecuteContentScriptSync to Mojo https://chromium-review.googlesource.com/c/chromium/src/+/3108452 * chore: update patches * remove unreachable code * Revert "Revert "chore: disable v8 oilpan"" This reverts commit fef495c0294e21760df51bddb5f7bf1ec9ed5f1e. * fixup mas patch * Reland "[include] Split out v8.h" https://chromium-review.googlesource.com/c/v8/v8/+/3113629 * chore: bump chromium in DEPS to 95.0.4624.0 * chore: bump chromium in DEPS to 95.0.4625.0 * chore: bump chromium in DEPS to 95.0.4626.0 * 3033504: Pass NavigationDownloadPolicy in CreateNewWindowParams https://chromium-review.googlesource.com/c/chromium/src/+/3033504 * 3058038: Introduce TestPrintingContext & test UpdatePrintSettings https://chromium-review.googlesource.com/c/chromium/src/+/3058038 * 3114943: [Conditional Focus][#4] Add tests and remove flag gating https://chromium-review.googlesource.com/c/chromium/src/+/3114943 * chore: update patch indices * chore: bump chromium in DEPS to 95.0.4627.0 * chore: update patches * 3093591: ozone: webpagepopups: calculate anchor for menu bounds. 4/* https://chromium-review.googlesource.com/c/chromium/src/+/3093591 * 3110414: [PA] Remove the leading cookie https://chromium-review.googlesource.com/c/chromium/src/+/3110414 * chore: update patches * 3076261: Move args_ to private in ExtensionFunction https://chromium-review.googlesource.com/c/chromium/src/+/3076261 * 3113629: Reland "[include] Split out v8.h" https://chromium-review.googlesource.com/c/v8/v8/+/3113629 * chore: bump chromium in DEPS to 95.0.4628.0 * chore: update patches * chore: bump chromium in DEPS to 95.0.4629.0 * chore: update patches * Fix chrome root store codegen for cross-compile builds. https://chromium-review.googlesource.com/c/chromium/src/+/3133701 Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-09-01 22:55:07 +03:00
const readBookmark = clipboard.readBookmark();
if (process.platform !== 'win32') {
expect(readBookmark.title).to.equal('a title');
}
expect(clipboard.readBookmark().url).to.equal('https://electronjs.org');
clipboard.writeText('no bookmark');
expect(clipboard.readBookmark()).to.deep.equal({
title: '',
url: ''
2016-06-25 01:10:32 +03:00
});
});
});
describe('clipboard.read()', () => {
ifit(process.platform !== 'linux')('does not crash when reading various custom clipboard types', () => {
2021-10-26 15:14:08 +03:00
const type = process.platform === 'darwin' ? 'NSFilenamesPboardType' : 'FileNameW';
expect(() => {
clipboard.read(type);
2021-10-26 15:14:08 +03:00
}).to.not.throw();
});
it('can read data written with writeBuffer', () => {
const testText = 'Testing read';
const buffer = Buffer.from(testText, 'utf8');
clipboard.writeBuffer('public/utf8-plain-text', buffer);
expect(clipboard.read('public/utf8-plain-text')).to.equal(testText);
});
2021-10-26 15:14:08 +03:00
});
2017-10-27 03:12:51 +03:00
describe('clipboard.write()', () => {
it('returns data correctly', () => {
const text = 'test';
const rtf = '{\\rtf1\\utf8 text}';
const p = path.join(fixtures, 'assets', 'logo.png');
const i = nativeImage.createFromPath(p);
chore: bump chromium to 126.0.6445.0 (main) (#41868) * chore: bump chromium in DEPS to 125.0.6421.0 * chore: bump chromium in DEPS to 125.0.6422.0 * Add ENABLE_BASE_TRACING flags for compatibility with enable_base_tracing = false on Windows https://chromium-review.googlesource.com/c/chromium/src/+/5434658 * chore: update patches * fixup: Add ENABLE_BASE_TRACING flags for compatibility with enable_base_tracing = false on Windows * chore: bump chromium in DEPS to 126.0.6423.0 * chore: update patches * 5426599: Next generation control of unsafe-buffers-usage plugin https://chromium-review.googlesource.com/c/chromium/src/+/5426599 * chore: bump chromium in DEPS to 126.0.6425.0 * chore: update patches * Roll clang+rust llvmorg-19-init-7229-g315c88c5-2 : llvmorg-19-init-8091-gab037c4f-1 / ceab6128fa48a616bfd3e3adf4bc80133b8ee223-1 : ab71ee7a9214c2793108a41efb065aa77aeb7326-1 https://chromium-review.googlesource.com/c/chromium/src/+/5444328 Also see https://issues.chromium.org/issues/332931387 * 5445074: [Views AX] Move AXEventNotificationDetails to ui/accessibility/ https://chromium-review.googlesource.com/c/chromium/src/+/5445074 Also 5455993: [Views AX] Rename AXEventNotificationDetails to AXUpdatesAndEvents | https://chromium-review.googlesource.com/c/chromium/src/+/5455993 * Pass IsolationInfo to ContentBrowserClient::WillCreateURLLoaderFactory() https://chromium-review.googlesource.com/c/chromium/src/+/5405301 * chore: bump chromium in DEPS to 126.0.6427.0 * chore: update patches * chore: remove no longer needed patch perfetto is now turned on so this patch is no longer needed. * chore: bump chromium in DEPS to 126.0.6429.0 * chore: bump chromium in DEPS to 126.0.6431.0 * chore: bump chromium in DEPS to 126.0.6433.0 * 5466654: Do not create a console if logging to a handle https://chromium-review.googlesource.com/c/chromium/src/+/5466654 * chore: fixup patch indices * Address Linux NonClientFrameView Changes - https://chromium-review.googlesource.com/c/chromium/src/+/5180720 - https://chromium-review.googlesource.com/c/chromium/src/+/5367794 * chore: bump chromium in DEPS to 126.0.6435.0 * chore: bump chromium in DEPS to 126.0.6437.0 * chore: update patches * chore: bump chromium in DEPS to 126.0.6439.0 * chore: bump chromium in DEPS to 126.0.6441.0 * 5477689: components/crash/content/tools: Format with yapf | https://chromium-review.googlesource.com/c/chromium/src/+/5477689 * 5485006: Remove enable_print_content_analysis GN flag | https://chromium-review.googlesource.com/c/chromium/src/+/5485006 * chore: update chromium patches * chore: bump chromium in DEPS to 126.0.6443.0 * 5465608: Convert DCHECKs near RenderWidgetHost, DelegatedFrameHost to CHECK | https://chromium-review.googlesource.com/c/chromium/src/+/5465608 * 5492605: Migrate TODOs referencing old crbug IDs to the new issue tracker IDs | https://chromium-review.googlesource.com/c/chromium/src/+/5492605 * chore: update patches * chore: bump chromium in DEPS to 126.0.6445.0 * chore: update patches * 5468588: Fullscreen: Encapsulate ExclusiveAccessBubble params in a struct | https://chromium-review.googlesource.com/c/chromium/src/+/5468588 * fixup! 5485006: Remove enable_print_content_analysis GN flag | https://chromium-review.googlesource.com/c/chromium/src/+/5485006 * 5461340: `size_t` in `mojo::DataPipe[Consumer|Producer]Handle`: /components. | https://chromium-review.googlesource.com/c/chromium/src/+/5461340 * 5480213: Add an EvictIds struct to FrameEvictorClient | https://chromium-review.googlesource.com/c/chromium/src/+/5480213 * 4341506: [api] Deprecate Isolate::IdleNotificationDeadline | https://chromium-review.googlesource.com/c/v8/v8/+/4341506 * 5300826: [v8-tasks] Add source location to v8::TaskRunner, step 4/4. | https://chromium-review.googlesource.com/c/v8/v8/+/5300826 * partially revert is_newly_created to allow for browser initiated about:blank loads * add dep on app_launch_prefetch Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5420149 * install sysroots from electron not from chrome We should add a new var upstream for `download_sysroots` so that we can skip downloading chromes at all. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5462469 * refactor: make UpdateFrameHints an override Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5473548 * fix ppapi * refactor: update namespace for pwm switches Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5444617 * 5459367: WebSQL: Restrict WebSQL service creation to Android only | https://chromium-review.googlesource.com/c/chromium/src/+/5459367 * 5455853: Revert "[Clipboard] Don't add meta charset tag for async write() method on Mac." | https://chromium-review.googlesource.com/c/chromium/src/+/5455853 * fixup! refactor: update namespace for pwm switches edd9e26 Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5444617 * 5147611: [heap] Add checks for ensuring position info slow path is not used in heap snapshot | https://chromium-review.googlesource.com/c/v8/v8/+/5147611 * fixup! 5412666: [heap] Also avoid heap allocation for allocation tracked functions | https://chromium-review.googlesource.com/c/v8/v8/+/5412666 * chore: add websql removal to breaking-changes.md --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: VerteDinde <vertedinde@electronjs.org> Co-authored-by: Keeley Hammond <khammond@slack-corp.com> Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
2024-05-10 18:21:10 +03:00
let markup = '<b>Hi</b>';
// CL: https://chromium-review.googlesource.com/c/chromium/src/+/5187335
if (process.platform === 'darwin') {
markup = '<meta charset=\'utf-8\'><b>Hi</b>';
}
2018-09-13 19:10:51 +03:00
const bookmark = { title: 'a title', url: 'test' };
2016-01-12 05:40:23 +03:00
clipboard.write({
2016-03-25 23:03:49 +03:00
text: 'test',
2016-01-12 05:40:23 +03:00
html: '<b>Hi</b>',
rtf: '{\\rtf1\\utf8 text}',
2016-06-25 01:14:28 +03:00
bookmark: 'a title',
image: i
2016-03-25 23:03:49 +03:00
});
expect(clipboard.readText()).to.equal(text);
expect(clipboard.readHTML()).to.equal(markup);
expect(clipboard.readRTF()).to.equal(rtf);
const readImage = clipboard.readImage();
expect(readImage.toDataURL()).to.equal(i.toDataURL());
if (process.platform !== 'linux') {
chore: bump chromium to 95.0.4629.0 (main) (#30676) * chore: bump chromium in DEPS to 95.0.4620.0 * chore: update patches * 3076261: Move args_ to private in ExtensionFunction https://chromium-review.googlesource.com/c/chromium/src/+/3076261 * [GURL -> SiteForCookies] content/public/browser/content_browser_client.h https://chromium-review.googlesource.com/c/chromium/src/+/3107759 * chore: fix -Wunreachable-code-return in node * Tracing to diagnose ContentScriptTracker-related bad message reports https://chromium-review.googlesource.com/c/chromium/src/+/3057922 * chore: bump chromium in DEPS to 95.0.4621.0 * chore: update patches * Remove title from the URL format on Windows. https://chromium-review.googlesource.com/c/chromium/src/+/3108445 * chore: bump chromium in DEPS to 95.0.4623.0 * Revert "chore: disable v8 oilpan" This reverts commit 5d255cf1d8e8efbb906047937a713279e5f800d0. (cherry picked from commit ba5cde4da2428020d99b7fb603c702878f95da78) * Change file paths in network context params to be relative. https://chromium-review.googlesource.com/c/chromium/src/+/3092927 * Code Health: Rename/replace content::WebUI::RegisterMessageCallback(). https://chromium-review.googlesource.com/c/chromium/src/+/3104691 * Migrate CanExecuteContentScriptSync to Mojo https://chromium-review.googlesource.com/c/chromium/src/+/3108452 * chore: update patches * remove unreachable code * Revert "Revert "chore: disable v8 oilpan"" This reverts commit fef495c0294e21760df51bddb5f7bf1ec9ed5f1e. * fixup mas patch * Reland "[include] Split out v8.h" https://chromium-review.googlesource.com/c/v8/v8/+/3113629 * chore: bump chromium in DEPS to 95.0.4624.0 * chore: bump chromium in DEPS to 95.0.4625.0 * chore: bump chromium in DEPS to 95.0.4626.0 * 3033504: Pass NavigationDownloadPolicy in CreateNewWindowParams https://chromium-review.googlesource.com/c/chromium/src/+/3033504 * 3058038: Introduce TestPrintingContext & test UpdatePrintSettings https://chromium-review.googlesource.com/c/chromium/src/+/3058038 * 3114943: [Conditional Focus][#4] Add tests and remove flag gating https://chromium-review.googlesource.com/c/chromium/src/+/3114943 * chore: update patch indices * chore: bump chromium in DEPS to 95.0.4627.0 * chore: update patches * 3093591: ozone: webpagepopups: calculate anchor for menu bounds. 4/* https://chromium-review.googlesource.com/c/chromium/src/+/3093591 * 3110414: [PA] Remove the leading cookie https://chromium-review.googlesource.com/c/chromium/src/+/3110414 * chore: update patches * 3076261: Move args_ to private in ExtensionFunction https://chromium-review.googlesource.com/c/chromium/src/+/3076261 * 3113629: Reland "[include] Split out v8.h" https://chromium-review.googlesource.com/c/v8/v8/+/3113629 * chore: bump chromium in DEPS to 95.0.4628.0 * chore: update patches * chore: bump chromium in DEPS to 95.0.4629.0 * chore: update patches * Fix chrome root store codegen for cross-compile builds. https://chromium-review.googlesource.com/c/chromium/src/+/3133701 Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2021-09-01 22:55:07 +03:00
if (process.platform !== 'win32') {
expect(clipboard.readBookmark()).to.deep.equal(bookmark);
} else {
expect(clipboard.readBookmark().url).to.equal(bookmark.url);
}
}
2016-03-25 23:03:49 +03:00
});
});
2016-10-25 07:59:04 +03:00
2021-10-26 15:14:08 +03:00
ifdescribe(process.platform === 'darwin')('clipboard.read/writeFindText(text)', () => {
it('reads and write text to the find pasteboard', () => {
2016-10-25 07:59:04 +03:00
clipboard.writeFindText('find this');
expect(clipboard.readFindText()).to.equal('find this');
2016-10-25 07:59:04 +03:00
});
});
describe('clipboard.readBuffer(format)', () => {
it('writes a Buffer for the specified format', function () {
2017-04-21 08:47:04 +03:00
const buffer = Buffer.from('writeBuffer', 'utf8');
chore: bump chromium to 93.0.4566.0 (main) (#29980) * chore: bump chromium in DEPS to 93.0.4562.0 * chore: update patches * [base] Made Value::Take{Dict,List}() rvalue ref-qualified. https://chromium-review.googlesource.com/c/chromium/src/+/2988105 * Revert "Reland "Roll src/buildtools/third_party/libc++/trunk/ 8fa879467..79a2e924d (426 commits)"" https://chromium-review.googlesource.com/c/chromium/src/+/2995482 This reverts commit 9691d6c265f010791c37d374248559969980ec65 and 797723ec838709ddeba0c104e30727ee0b7ac8ca * Pass gfx::Insets to GetHTComponentForFrame https://chromium-review.googlesource.com/c/chromium/src/+/2984243 * chore: bump chromium in DEPS to 93.0.4563.0 * [Clipboard API] Clipboard Custom Formats implementation Part 2. https://chromium-review.googlesource.com/c/chromium/src/+/2967649 * chore: update patches * chore: bump chromium in DEPS to 93.0.4564.0 * chore: bump chromium in DEPS to 93.0.4565.0 * chore: update patches * Prevent use of base::NoDestructor for trivially-destructible types https://chromium-review.googlesource.com/c/chromium/src/+/2998672 * chore: update patches * fixup! [Clipboard API] Clipboard Custom Formats implementation Part 2. * chore: bump chromium in DEPS to 93.0.4566.0 * chore: update patches * chore: add missing header * ci: do not run clipboard tests on WOA Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-07-06 15:17:13 +03:00
clipboard.writeBuffer('public/utf8-plain-text', buffer);
expect(buffer.equals(clipboard.readBuffer('public/utf8-plain-text'))).to.equal(true);
2017-04-21 08:47:04 +03:00
});
it('throws an error when a non-Buffer is specified', () => {
expect(() => {
clipboard.writeBuffer('public/utf8-plain-text', 'hello' as any);
}).to.throw(/buffer must be a node Buffer/);
});
ifit(process.platform !== 'win32')('writes a Buffer using a raw format that is used by native apps', function () {
const message = 'Hello from Electron!';
const buffer = Buffer.from(message);
let rawFormat = 'text/plain';
if (process.platform === 'darwin') {
rawFormat = 'public.utf8-plain-text';
}
clipboard.writeBuffer(rawFormat, buffer);
expect(clipboard.readText()).to.equal(message);
});
2017-04-21 08:47:04 +03:00
});
2016-03-25 23:03:49 +03:00
});