summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-27 14:07:41 +0000
committerdcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-27 14:07:41 +0000
commite09c0ea14262fa9cb51c4b0d00c297ffccc607ad (patch)
tree54817e247cbd6b97b2fba43dae470f976cd7d111
parenteb78e0ac8aac8e78812282b2c993a11a4dc2553a (diff)
downloadchromium_src-e09c0ea14262fa9cb51c4b0d00c297ffccc607ad.zip
chromium_src-e09c0ea14262fa9cb51c4b0d00c297ffccc607ad.tar.gz
chromium_src-e09c0ea14262fa9cb51c4b0d00c297ffccc607ad.tar.bz2
Remove experimental.clipboard API in favor of document.execCommand()
This reverts r105855, since event.clipboardData.setData is properly implemented. BUG=102565 TEST=compiles Review URL: http://codereview.chromium.org/8662033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111654 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/extensions/extension_clipboard_api.cc270
-rw-r--r--chrome/browser/extensions/extension_clipboard_api.h52
-rw-r--r--chrome/browser/extensions/extension_clipboard_apitest.cc31
-rw-r--r--chrome/browser/extensions/extension_function_dispatcher.cc6
-rw-r--r--chrome/chrome_browser.gypi2
-rw-r--r--chrome/chrome_tests.gypi1
-rw-r--r--chrome/common/extensions/api/extension_api.json112
-rw-r--r--chrome/test/data/extensions/api_test/clipboard_api/extension/manifest.json7
-rw-r--r--chrome/test/data/extensions/api_test/clipboard_api/extension/test.html59
-rw-r--r--chrome/test/data/extensions/api_test/clipboard_api/extension_mac/manifest.json7
-rw-r--r--chrome/test/data/extensions/api_test/clipboard_api/extension_mac/test.html46
-rw-r--r--chrome/test/data/extensions/api_test/clipboard_api/extension_no_permission/manifest.json7
-rw-r--r--chrome/test/data/extensions/api_test/clipboard_api/extension_no_permission/test.html14
-rw-r--r--chrome/test/data/extensions/api_test/clipboard_api/extension_win/manifest.json7
-rw-r--r--chrome/test/data/extensions/api_test/clipboard_api/extension_win/test.html65
15 files changed, 0 insertions, 686 deletions
diff --git a/chrome/browser/extensions/extension_clipboard_api.cc b/chrome/browser/extensions/extension_clipboard_api.cc
deleted file mode 100644
index 1923c10..0000000
--- a/chrome/browser/extensions/extension_clipboard_api.cc
+++ /dev/null
@@ -1,270 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/extensions/extension_clipboard_api.h"
-
-#include <string>
-
-#include "base/string16.h"
-#include "base/values.h"
-#include "chrome/browser/browser_process.h"
-#include "googleurl/src/gurl.h"
-#include "ui/base/clipboard/clipboard.h"
-#include "ui/base/clipboard/scoped_clipboard_writer.h"
-
-namespace {
-
-enum SupportedMimeType {
- MIME_TYPE_TEXT,
- MIME_TYPE_HTML,
- // Not really a type. Used when iterating through enum values. Should allways
- // be the last value in the enum.
- MIME_TYPE_COUNT
-};
-
-const char kDataProperty[] = "data";
-const char kUrlProperty[] = "url";
-
-const char kMimeTypePlainText[] = "text/plain";
-const char kMimeTypeHtml[] = "text/html";
-
-const char kBufferStandard[] = "standard";
-const char kBufferSelection[] = "selection";
-
-const char kMimeTypeNotSupportedError[] = "MIME type is not supported.";
-const char kBufferReadNotSupportedError[] =
- "Reading from the buffer is not supported.";
-const char kBufferWriteNotSupportedError[] =
- "Writing to the buffer is not supported.";
-const char kBufferNotSupportedError[] = "Buffer is not supported.";
-
-// Converts data MIME type to data format known to ui::Clipboard. MIME type is
-// given as a string. Returns false iff the string could not be converted.
-bool ConvertMimeTypeStringToClipboardType(
- const std::string& mime_type,
- ui::Clipboard::FormatType* format_type) {
- if (mime_type == kMimeTypePlainText) {
- *format_type = ui::Clipboard::GetPlainTextFormatType();
- return true;
- }
- if (mime_type == kMimeTypeHtml) {
- *format_type = ui::Clipboard::GetHtmlFormatType();
- return true;
- }
- return false;
-}
-
-// Converts data MIME type to data format known to ui::Clipboard. MIME type is
-// given as a enum value. Returns false iff the enum value could not be
-// converted.
-bool ConvertMimeTypeEnumToClipboardType(
- SupportedMimeType mime_type,
- ui::Clipboard::FormatType* format_type) {
- switch (mime_type) {
- case MIME_TYPE_TEXT:
- *format_type = ui::Clipboard::GetPlainTextFormatType();
- return true;
- case MIME_TYPE_HTML:
- *format_type = ui::Clipboard::GetHtmlFormatType();
- return true;
- default:
- return false;
- }
-}
-
-// Converts MIME type enum value to string. Returns false iff the enum could not
-// be converted.
-bool MimeTypeEnumToString(SupportedMimeType mime_type_enum,
- std::string* mime_type_str) {
- switch (mime_type_enum) {
- case MIME_TYPE_TEXT:
- *mime_type_str = kMimeTypePlainText;
- return true;
- case MIME_TYPE_HTML:
- *mime_type_str = kMimeTypeHtml;
- return true;
- default:
- return false;
- }
-}
-
-// Converts a buffer type given as a string to buffer type known to
-// ui::Clipboard. Returns false iff the conversion is not possible.
-bool ConvertBufferTypeToClipboardType(const std::string& buffer,
- ui::Clipboard::Buffer* buffer_type) {
- if (buffer == kBufferStandard) {
- *buffer_type = ui::Clipboard::BUFFER_STANDARD;
- return true;
- }
- if (buffer == kBufferSelection) {
- *buffer_type = ui::Clipboard::BUFFER_SELECTION;
- return true;
- }
- return false;
-}
-
-} // namespace
-
-bool WriteDataClipboardFunction::RunImpl() {
- if (args_->GetSize() != 3 && args_->GetSize() != 4) {
- return false;
- }
-
- std::string mime_type;
- args_->GetString(0, &mime_type);
-
- std::string buffer;
- args_->GetString(1, &buffer);
-
- // At the moment only writing to standard cllipboard buffer is possible.
- if (buffer != kBufferStandard) {
- error_ = kBufferWriteNotSupportedError;
- return false;
- }
-
- if (mime_type == kMimeTypePlainText)
- return WritePlainText(buffer);
-
- if (mime_type == kMimeTypeHtml)
- return WriteHtml(buffer);
-
- error_ = kMimeTypeNotSupportedError;
- return false;
-}
-
-bool WriteDataClipboardFunction::WritePlainText(const std::string& buffer) {
- string16 data;
- args_->GetString(2, &data);
-
- ui::ScopedClipboardWriter scw(g_browser_process->clipboard());
-
- scw.WriteText(data);
- return true;
-}
-
-bool WriteDataClipboardFunction::WriteHtml(const std::string& buffer) {
- string16 data;
- args_->GetString(2, &data);
-
- std::string url_str;
- // |url| parameter is optional.
- if (args_->GetSize() == 4)
- args_->GetString(3, &url_str);
-
- // We do this to verify passed url is well-formed.
- GURL url(url_str);
-
- ui::ScopedClipboardWriter scw(g_browser_process->clipboard());
-
- scw.WriteHTML(data, url.spec());
- return true;
-}
-
-bool ReadDataClipboardFunction::RunImpl() {
- if (args_->GetSize() != 2) {
- return false;
- }
- std::string mime_type;
- args_->GetString(0, &mime_type);
-
- std::string buffer;
- args_->GetString(1, &buffer);
-
-// Windows, Mac and Aura don't support selection clipboard buffer.
-#if (defined(OS_WIN) || defined(OS_MACOSX) || defined(USE_AURA))
- if (buffer != kBufferStandard) {
- error_ = kBufferReadNotSupportedError;
- return false;
- }
-#endif
-
- if (mime_type == kMimeTypePlainText)
- return ReadPlainText(buffer);
-
- if (mime_type == kMimeTypeHtml)
- return ReadHtml(buffer);
-
- error_ = kMimeTypeNotSupportedError;
- return false;
-}
-
-bool ReadDataClipboardFunction::ReadPlainText(const std::string& buffer) {
- string16 data;
- ui::Clipboard* clipboard = g_browser_process->clipboard();
-
- ui::Clipboard::Buffer clipboard_buffer;
- if (ConvertBufferTypeToClipboardType(buffer, &clipboard_buffer)) {
- clipboard->ReadText(clipboard_buffer, &data);
- } else {
- error_ = kBufferNotSupportedError;
- return false;
- }
-
- DictionaryValue* callbackData = new DictionaryValue();
- callbackData->SetString(kDataProperty, data);
- result_.reset(callbackData);
- return true;
-}
-
-bool ReadDataClipboardFunction::ReadHtml(const std::string& buffer) {
- ui::Clipboard* clipboard = g_browser_process->clipboard();
-
- string16 data;
- std::string url;
- uint32 fragment_start = 0;
- uint32 fragment_end = 0;
- ui::Clipboard::Buffer clipboard_buffer;
-
- if (ConvertBufferTypeToClipboardType(buffer, &clipboard_buffer)) {
- clipboard->ReadHTML(clipboard_buffer, &data, &url, &fragment_start,
- &fragment_end);
- } else {
- error_ = kBufferNotSupportedError;
- return false;
- }
-
- DictionaryValue* html_data = new base::DictionaryValue();
- size_t fragment_len = static_cast<size_t>(fragment_end - fragment_start);
- html_data->SetString(kDataProperty,
- data.substr(static_cast<size_t>(fragment_start),
- fragment_len));
- html_data->SetString(kUrlProperty, url);
- result_.reset(html_data);
-
- return true;
-}
-
-bool GetAvailableMimeTypesClipboardFunction::RunImpl() {
- if (args_->GetSize() != 1) {
- return false;
- }
-
- std::string buffer_arg;
- args_->GetString(0, &buffer_arg);
-
- ui::Clipboard::Buffer buffer;
- if (!ConvertBufferTypeToClipboardType(buffer_arg, &buffer)) {
- error_ = kBufferNotSupportedError;
- return false;
- }
-
- ui::Clipboard* clipboard = g_browser_process->clipboard();
-
- ListValue* availableMimeTypes = new ListValue();
-
- for (int i = 0; i < MIME_TYPE_COUNT; i++) {
- ui::Clipboard::FormatType format;
- SupportedMimeType mime_type = static_cast<SupportedMimeType>(i);
- if (ConvertMimeTypeEnumToClipboardType(mime_type, &format) &&
- clipboard->IsFormatAvailable(format, buffer)) {
- std::string mime_type_str;
- if (!MimeTypeEnumToString(mime_type, &mime_type_str))
- continue;
- availableMimeTypes->Append(new StringValue(mime_type_str));
- }
- }
-
- result_.reset(availableMimeTypes);
- return true;
-}
diff --git a/chrome/browser/extensions/extension_clipboard_api.h b/chrome/browser/extensions/extension_clipboard_api.h
deleted file mode 100644
index 3687ca2..0000000
--- a/chrome/browser/extensions/extension_clipboard_api.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_CLIPBOARD_API_H_
-#define CHROME_BROWSER_EXTENSIONS_EXTENSION_CLIPBOARD_API_H_
-#pragma once
-
-#include "chrome/browser/extensions/extension_function.h"
-
-// Writes data to the clipboard. Data format and buffer data will be written to
-// are specified by parameters passed from the extension.
-// Currently, only writing to standard buffer is possible.
-class WriteDataClipboardFunction : public SyncExtensionFunction {
- public:
- virtual bool RunImpl() OVERRIDE;
-
- private:
- // Writes plain text to the buffer. Ignores url argument if sent from the
- // extension. Only standard buffer is currently supported.
- bool WritePlainText(const std::string& buffer);
- // Writes html to the buffer. Only standard buffer is currently supported.
- bool WriteHtml(const std::string& buffer);
-
- DECLARE_EXTENSION_FUNCTION_NAME("experimental.clipboard.writeData")
-};
-
-// Reads data from the clipboard. Data format and buffer data will be written to
-// are specified by parameters passed from the extension.
-class ReadDataClipboardFunction : public SyncExtensionFunction {
- public:
- virtual bool RunImpl() OVERRIDE;
-
- private:
- // Reads plain text from the clipboard buffer. Callback will have only data
- // property set. Selection buffer not supported for Win and Mac.
- bool ReadPlainText(const std::string& buffer);
- // Reads html from the buffer. Selection buffer not supported for Win and Mac.
- bool ReadHtml(const std::string& buffer);
-
- DECLARE_EXTENSION_FUNCTION_NAME("experimental.clipboard.readData")
-};
-
-// For a given clipbord buffer, returns list of data types available on it.
-class GetAvailableMimeTypesClipboardFunction : public SyncExtensionFunction {
- public:
- virtual bool RunImpl() OVERRIDE;
- private:
- DECLARE_EXTENSION_FUNCTION_NAME("experimental.clipboard.getAvailableTypes")
-};
-
-#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_CLIPBOARD_API_H_
diff --git a/chrome/browser/extensions/extension_clipboard_apitest.cc b/chrome/browser/extensions/extension_clipboard_apitest.cc
deleted file mode 100644
index 86a850f..0000000
--- a/chrome/browser/extensions/extension_clipboard_apitest.cc
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/command_line.h"
-#include "chrome/browser/extensions/extension_apitest.h"
-#include "chrome/common/chrome_switches.h"
-
-class ExtensionClipboardApiTest : public ExtensionApiTest {
- virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
- CommandLine::ForCurrentProcess()->AppendSwitch(
- switches::kEnableExperimentalExtensionApis);
-
- ExtensionApiTest::SetUpInProcessBrowserTestFixture();
- }
-};
-
-IN_PROC_BROWSER_TEST_F(ExtensionClipboardApiTest, WriteAndReadTest) {
-#if defined(OS_WIN) || defined(USE_AURA)
- ASSERT_TRUE(RunExtensionTest("clipboard_api/extension_win")) << message_;
-#elif defined(OS_MACOSX)
- ASSERT_TRUE(RunExtensionTest("clipboard_api/extension_mac")) << message_;
-#else // !defined(OS_WIN) && !defined(OS_MACOSX) && !defined(USE_AURA)
- ASSERT_TRUE(RunExtensionTest("clipboard_api/extension")) << message_;
-#endif
-};
-
-IN_PROC_BROWSER_TEST_F(ExtensionClipboardApiTest, NoPermission) {
- ASSERT_FALSE(RunExtensionTest("clipboard_api/extension_no_permission"))
- << message_;
-};
diff --git a/chrome/browser/extensions/extension_function_dispatcher.cc b/chrome/browser/extensions/extension_function_dispatcher.cc
index 8ea8bb7..19e0c2ad 100644
--- a/chrome/browser/extensions/extension_function_dispatcher.cc
+++ b/chrome/browser/extensions/extension_function_dispatcher.cc
@@ -20,7 +20,6 @@
#include "chrome/browser/extensions/extension_browser_actions_api.h"
#include "chrome/browser/extensions/extension_chrome_auth_private_api.h"
#include "chrome/browser/extensions/extension_clear_api.h"
-#include "chrome/browser/extensions/extension_clipboard_api.h"
#include "chrome/browser/extensions/extension_content_settings_api.h"
#include "chrome/browser/extensions/extension_context_menu_api.h"
#include "chrome/browser/extensions/extension_cookies_api.h"
@@ -467,11 +466,6 @@ void FactoryRegistry::ResetFunctions() {
// SavePage
RegisterFunction<SavePageAsMHTMLFunction>();
- // Clipboard
- RegisterFunction<WriteDataClipboardFunction>();
- RegisterFunction<ReadDataClipboardFunction>();
- RegisterFunction<GetAvailableMimeTypesClipboardFunction>();
-
// TopSites
RegisterFunction<GetTopSitesFunction>();
}
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index e696465..22ec93e 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -959,8 +959,6 @@
'browser/extensions/extension_clear_api.h',
'browser/extensions/extension_clear_api_constants.cc',
'browser/extensions/extension_clear_api_constants.h',
- 'browser/extensions/extension_clipboard_api.cc',
- 'browser/extensions/extension_clipboard_api.h',
'browser/extensions/extension_content_settings_api.cc',
'browser/extensions/extension_content_settings_api.h',
'browser/extensions/extension_content_settings_api_constants.cc',
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 8b05ccb..cd9f4ed 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -2540,7 +2540,6 @@
'browser/extensions/extension_browsertests_misc.cc',
'browser/extensions/extension_chrome_auth_private_apitest.cc',
'browser/extensions/extension_clear_apitest.cc',
- 'browser/extensions/extension_clipboard_apitest.cc',
'browser/extensions/extension_content_settings_apitest.cc',
'browser/extensions/extension_context_menu_apitest.cc',
'browser/extensions/extension_context_menu_browsertest.cc',
diff --git a/chrome/common/extensions/api/extension_api.json b/chrome/common/extensions/api/extension_api.json
index 60b9d1c..3aba800 100644
--- a/chrome/common/extensions/api/extension_api.json
+++ b/chrome/common/extensions/api/extension_api.json
@@ -9114,118 +9114,6 @@
]
},
{
- "namespace": "experimental.clipboard",
- "nodoc": true,
- "types": [
- {
- "id": "mimeTypeEnum",
- "type": "string",
- "description": "MIME type of the data on the clipboard.",
- "enum": ["text/plain", "text/html"]
- },
- {
- "id": "bufferEnum",
- "type": "string",
- "description": "Buffers available on the clipboard.",
- "enum": ["standard", "selection"]
- }
- ],
- "functions": [
- {
- "name": "writeData",
- "description": "Writes some plain text data to web clipboard.",
- "type": "function",
- "parameters": [
- {
- "name": "mimeType",
- "$ref": "mimeTypeEnum",
- "description": "Type of data that will be written to the clipboard."
- },
- {
- "name": "buffer",
- "$ref": "bufferEnum",
- "description": "Clipboard to which data will be written. Currently only standard clipboard is supported."
- },
- {
- "name": "data",
- "type": "string",
- "description": "Data that will be writen to the clipboard."
- },
- {
- "name": "url",
- "type": "string",
- "description": "Type of data that will be written to the clipboard.",
- "optional": true
- }
- ]
- },
- {
- "name": "readData",
- "description": "Reads data that is currently on clipboard.",
- "type": "function",
- "parameters": [
- {
- "name": "mimeType",
- "$ref": "mimeTypeEnum",
- "description": "Type of data that will be read from the clipboard."
- },
- {
- "name": "buffer",
- "$ref": "bufferEnum",
- "description": "Clipboard buffer from which data will be read."
- },
- {
- "name": "callback",
- "description": "Callback that will be called when data is read from the clipboard.",
- "type": "function",
- "parameters": [
- {
- "name": "callbackData",
- "type": "object",
- "properties": {
- "data": {
- "type": "string",
- "description": "Data read from the clipboard."
- },
- "url": {
- "type": "string",
- "description": "Url read from the clipboard.",
- "optional": true
- }
- }
- }
- ]
- }
- ]
- },
- {
- "name": "getAvailableTypes",
- "description": "Retrieves list of MIME types that support data currently on the clipboard buffer.",
- "type": "function",
- "parameters": [
- {
- "name": "buffer",
- "$ref": "bufferEnum",
- "description": "Clipboard buffer whose available MIME types will be retrieved."
- },
- {
- "name": "callback",
- "description": "Callback that will be called when the result is determined.",
- "type": "function",
- "parameters": [
- {
- "name": "avaliableMimeTypes",
- "description": "List of available MIME types.",
- "type": "array",
- "items": { "$ref": "mimeTypeEnum" }
- }
- ]
- }
- ]
- }
- ]
- },
- {
"namespace": "experimental.topSites",
"nodoc": true,
"types": [],
diff --git a/chrome/test/data/extensions/api_test/clipboard_api/extension/manifest.json b/chrome/test/data/extensions/api_test/clipboard_api/extension/manifest.json
deleted file mode 100644
index be0d5bd..0000000
--- a/chrome/test/data/extensions/api_test/clipboard_api/extension/manifest.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "name": "chrome.experimental.clipboard.extension",
- "version": "0.1",
- "description": "end-to-end browser test for experimental clipboard api",
- "background_page": "test.html",
- "permissions": ["experimental", "clipboard"]
-}
diff --git a/chrome/test/data/extensions/api_test/clipboard_api/extension/test.html b/chrome/test/data/extensions/api_test/clipboard_api/extension/test.html
deleted file mode 100644
index f5e1c79..0000000
--- a/chrome/test/data/extensions/api_test/clipboard_api/extension/test.html
+++ /dev/null
@@ -1,59 +0,0 @@
-<script>
-var htmlTextPrefix = '<meta http-equiv=\"content-type\" ' +
- 'content=\"text/html; charset=utf-8\">';
-var htmlText = '<html></html>';
-var plainText = 'some text';
-var url = 'http://www.google.com/a?a=s';
-
-var plainTextType = 'text/plain';
-var htmlType = 'text/html';
-
-var standardBuffer = 'standard';
-var selectionBuffer = 'selection';
-
-chrome.test.runTests([
- function WriteAndReadText() {
- chrome.experimental.clipboard.writeData(plainTextType, standardBuffer,
- plainText);
- chrome.experimental.clipboard.readData(plainTextType, standardBuffer,
- chrome.test.callbackPass(function(callbackData) {
- chrome.test.assertEq(callbackData.data, plainText);
- chrome.test.assertEq(undefined, callbackData.url);
- }));
- chrome.experimental.clipboard.getAvailableTypes(standardBuffer,
- chrome.test.callbackPass(function(availableTypes) {
- chrome.test.assertEq(1, availableTypes.length);
- chrome.test.assertEq(plainTextType, availableTypes[0])
- }));
- chrome.experimental.clipboard.readData(plainTextType, selectionBuffer,
- chrome.test.callbackPass(function(callbackData) {
- chrome.test.assertTrue(plainText != callbackData.data);
- chrome.test.assertEq(undefined, callbackData.url);
- }));
- chrome.experimental.clipboard.readData(htmlType, standardBuffer,
- chrome.test.callbackPass(function(callbackData) {
- chrome.test.assertEq('', callbackData.data);
- chrome.test.assertEq('', callbackData.url);
- }));
- },
- function WriteAndReadHtml() {
- chrome.experimental.clipboard.writeData(htmlType, standardBuffer, htmlText,
- url);
- chrome.experimental.clipboard.readData(htmlType, standardBuffer,
- chrome.test.callbackPass(function(callbackData) {
- chrome.test.assertEq(callbackData.data, htmlTextPrefix + htmlText);
- // At the moment URL is returned on Windows only.
- chrome.test.assertEq('', callbackData.url);
- }));
- chrome.experimental.clipboard.getAvailableTypes(standardBuffer,
- chrome.test.callbackPass(function(availableTypes) {
- chrome.test.assertEq(1, availableTypes.length);
- chrome.test.assertEq(htmlType, availableTypes[0])
- }));
- chrome.experimental.clipboard.readData(plainTextType, standardBuffer,
- chrome.test.callbackPass(function(callbackData) {
- chrome.test.assertEq(callbackData.data, '');
- }));
- }
-]);
-</script>
diff --git a/chrome/test/data/extensions/api_test/clipboard_api/extension_mac/manifest.json b/chrome/test/data/extensions/api_test/clipboard_api/extension_mac/manifest.json
deleted file mode 100644
index be0d5bd..0000000
--- a/chrome/test/data/extensions/api_test/clipboard_api/extension_mac/manifest.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "name": "chrome.experimental.clipboard.extension",
- "version": "0.1",
- "description": "end-to-end browser test for experimental clipboard api",
- "background_page": "test.html",
- "permissions": ["experimental", "clipboard"]
-}
diff --git a/chrome/test/data/extensions/api_test/clipboard_api/extension_mac/test.html b/chrome/test/data/extensions/api_test/clipboard_api/extension_mac/test.html
deleted file mode 100644
index 0e83bf3..0000000
--- a/chrome/test/data/extensions/api_test/clipboard_api/extension_mac/test.html
+++ /dev/null
@@ -1,46 +0,0 @@
-<script>
-var htmlTextPrefix = '<meta charset=\'utf-8\'>';
-var htmlText = '<html></html>';
-var plainText = 'some text';
-var url = 'http://www.google.com/a?a=s';
-
-var plainTextType = 'text/plain';
-var htmlType = 'text/html';
-
-var standardBuffer = 'standard';
-var selectionBuffer = 'selection';
-
-
-chrome.test.runTests([
- function WriteAndReadText() {
- chrome.experimental.clipboard.writeData(plainTextType, standardBuffer,
- plainText);
- chrome.experimental.clipboard.readData(plainTextType, standardBuffer,
- chrome.test.callbackPass(function(callbackData) {
- chrome.test.assertEq(callbackData.data, plainText);
- chrome.test.assertTrue(callbackData.url == undefined);
- }));
- chrome.experimental.clipboard.getAvailableTypes(standardBuffer,
- chrome.test.callbackPass(function(availableTypes) {
- chrome.test.assertEq(1, availableTypes.length);
- chrome.test.assertEq(plainTextType, availableTypes[0])
- }));
- },
- function WriteAndReadHtml() {
- chrome.experimental.clipboard.writeData(htmlType, standardBuffer, htmlText,
- url);
- chrome.experimental.clipboard.readData(htmlType, standardBuffer,
- chrome.test.callbackPass(function(callbackData) {
- chrome.test.assertEq(callbackData.data, htmlTextPrefix + htmlText);
-
- // At the moment URL is returned on Windows only.
- chrome.test.assertEq('', callbackData.url);
- }));
- chrome.experimental.clipboard.getAvailableTypes(standardBuffer,
- chrome.test.callbackPass(function(availableTypes) {
- chrome.test.assertEq(1, availableTypes.length);
- chrome.test.assertEq(htmlType, availableTypes[0])
- }));
- }
-]);
-</script>
diff --git a/chrome/test/data/extensions/api_test/clipboard_api/extension_no_permission/manifest.json b/chrome/test/data/extensions/api_test/clipboard_api/extension_no_permission/manifest.json
deleted file mode 100644
index 11e496d..0000000
--- a/chrome/test/data/extensions/api_test/clipboard_api/extension_no_permission/manifest.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "name": "chrome.experimental.clipboard.extension_no_permission",
- "version": "0.1",
- "description": "end-to-end browser test for clipboard api permissions",
- "background_page": "test.html",
- "permissions": ["clipboard"]
-}
diff --git a/chrome/test/data/extensions/api_test/clipboard_api/extension_no_permission/test.html b/chrome/test/data/extensions/api_test/clipboard_api/extension_no_permission/test.html
deleted file mode 100644
index f6fdb4b..0000000
--- a/chrome/test/data/extensions/api_test/clipboard_api/extension_no_permission/test.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<script>
-// Test to ensure call to experimental.clipboard api without experimental
-// permission fails.
-chrome.test.runTests([
- function read() {
- chrome.experimental.clipboard.readData('text/plain', 'standard',
- function callback(data) {
- // This test is expected to fail, so if unwanted behaviour occurs
- // (readData implementation gets called), make it pass.
- chrome.test.succeed();
- });
- }
-]);
-</script>
diff --git a/chrome/test/data/extensions/api_test/clipboard_api/extension_win/manifest.json b/chrome/test/data/extensions/api_test/clipboard_api/extension_win/manifest.json
deleted file mode 100644
index 44f4cae..0000000
--- a/chrome/test/data/extensions/api_test/clipboard_api/extension_win/manifest.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "name": "chrome.clipboard_private.extension",
- "version": "0.1",
- "description": "end-to-end browser test on Widnows for clipboard api",
- "background_page": "test.html",
- "permissions": ["experimental", "clipboard"]
-}
diff --git a/chrome/test/data/extensions/api_test/clipboard_api/extension_win/test.html b/chrome/test/data/extensions/api_test/clipboard_api/extension_win/test.html
deleted file mode 100644
index dce1c08..0000000
--- a/chrome/test/data/extensions/api_test/clipboard_api/extension_win/test.html
+++ /dev/null
@@ -1,65 +0,0 @@
-<script>
-var htmlTextPrefix = '<meta http-equiv=\"content-type\" ' +
- 'content=\"text/html; charset=utf-8\">';
-var htmlText = '<html><img src=\"folder/image.jpg\"></img></html>';
-var plainText = 'some text';
-var url = 'http://www.google.com/';
-var malformedUrl = 'something';
-
-var plainTextType = 'text/plain';
-var htmlType = 'text/html';
-
-var standardBuffer = 'standard';
-var selectionBuffer = 'selection';
-
-chrome.test.runTests([
- function WriteAndReadText() {
- chrome.experimental.clipboard.writeData(plainTextType, standardBuffer,
- plainText);
- chrome.experimental.clipboard.readData(plainTextType, standardBuffer,
- chrome.test.callbackPass(function(callbackData) {
- chrome.test.assertEq(callbackData.data, plainText);
- chrome.test.assertTrue(callbackData.url == undefined);
- }));
- chrome.experimental.clipboard.readData(plainTextType, selectionBuffer,
- chrome.test.callbackFail("Reading from the buffer is not supported."));
- chrome.experimental.clipboard.getAvailableTypes(standardBuffer,
- chrome.test.callbackPass(function(availableTypes) {
- chrome.test.assertEq(1, availableTypes.length);
- chrome.test.assertEq(plainTextType, availableTypes[0])
- }));
- chrome.experimental.clipboard.readData(htmlType, standardBuffer,
- chrome.test.callbackPass(function(callbackData) {
- chrome.test.assertEq(callbackData.data, '');
- chrome.test.assertEq(callbackData.url, '');
- }));
- },
- function WriteAndReadHtml() {
- chrome.experimental.clipboard.writeData(htmlType, standardBuffer, htmlText,
- url);
- chrome.experimental.clipboard.readData(htmlType, standardBuffer,
- chrome.test.callbackPass(function(callbackData) {
- chrome.test.assertEq(htmlText, callbackData.data.trim());
- chrome.test.assertEq(url, callbackData.url);
- }));
- chrome.experimental.clipboard.getAvailableTypes(standardBuffer,
- chrome.test.callbackPass(function(availableTypes) {
- chrome.test.assertEq(1, availableTypes.length);
- chrome.test.assertEq(htmlType, availableTypes[0])
- }));
- chrome.experimental.clipboard.readData(plainTextType, standardBuffer,
- chrome.test.callbackPass(function(callbackData) {
- chrome.test.assertEq(callbackData.data, '');
- }));
- },
- function WriteAndReadHtmlWithMalformedUrl() {
- chrome.experimental.clipboard.writeData(htmlType, standardBuffer, htmlText,
- malformedUrl);
- chrome.experimental.clipboard.readData(htmlType, standardBuffer,
- chrome.test.callbackPass(function(callbackData) {
- chrome.test.assertEq(htmlText, callbackData.data.trim());
- chrome.test.assertEq('', callbackData.url);
- }));
- }
-]);
-</script>