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

Side by Side Diff: chrome/browser/extensions/clipboard_app_apitest.cc

Issue 6976002: Support clipboardRead and clipboardWrite permission for hosted apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 7 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
« no previous file with comments | « no previous file | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/extensions/extension_apitest.h"
6 #include "chrome/browser/ui/browser.h"
7 #include "chrome/test/ui_test_utils.h"
8 #include "content/browser/tab_contents/tab_contents.h"
9 #include "googleurl/src/gurl.h"
10 #include "net/base/mock_host_resolver.h"
11
12 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ClipboardApp) {
13 host_resolver()->AddRule("*", "127.0.0.1");
14 ASSERT_TRUE(StartTestServer());
15
16 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("clipboard_app")));
17
18 GURL base_url = test_server()->GetURL(
19 "files/extensions/api_test/clipboard_app/");
20 GURL::Replacements replace_host;
21 std::string host_str("localhost"); // Must stay in scope with replace_host.
22 replace_host.SetHostStr(host_str);
23 base_url = base_url.ReplaceComponents(replace_host);
24
25 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("main.html"));
26
27 const wchar_t kScript[] =
28 L"function runTest() {"
29 L" document.body.addEventListener('copy', runTest2);"
Erik does not do reviews 2011/05/20 21:49:01 This approach is a bit of a bummer since it depend
30 L" document.execCommand('copy');"
31 L"}"
32 L"function runTest2() {"
33 L" document.body.addEventListener('paste', runTest3);"
34 L" document.execCommand('paste');"
35 L"}"
36 L"function runTest3() {"
37 L" window.domAutomationController.send(true);"
38 L"}"
39 L"runTest();";
40
41 bool result = false;
42 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
43 browser()->GetSelectedTabContents()->render_view_host(),
44 L"",
45 kScript,
46 &result));
47 EXPECT_TRUE(result);
48 }
OLDNEW
« no previous file with comments | « no previous file | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698