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

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

Issue 10702029: Move tab functions off Browser into browser_tabstrip and browser_tabrestore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/stringprintf.h" 5 #include "base/stringprintf.h"
6 #include "chrome/browser/extensions/extension_apitest.h" 6 #include "chrome/browser/extensions/extension_apitest.h"
7 #include "chrome/browser/ui/browser.h" 7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/browser/ui/browser_tabstrip.h"
8 #include "chrome/test/base/ui_test_utils.h" 9 #include "chrome/test/base/ui_test_utils.h"
9 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
10 #include "googleurl/src/gurl.h" 11 #include "googleurl/src/gurl.h"
11 #include "net/base/mock_host_resolver.h" 12 #include "net/base/mock_host_resolver.h"
12 13
13 namespace { 14 namespace {
14 15
15 class ClipboardApiTest : public ExtensionApiTest { 16 class ClipboardApiTest : public ExtensionApiTest {
16 public: 17 public:
17 bool LoadHostedApp(const std::string& app_name, 18 bool LoadHostedApp(const std::string& app_name,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 60
60 bool ClipboardApiTest::ExecutePasteInSelectedTab(bool* result) { 61 bool ClipboardApiTest::ExecutePasteInSelectedTab(bool* result) {
61 const wchar_t kScript[] = 62 const wchar_t kScript[] =
62 L"window.domAutomationController.send(document.execCommand('paste'))"; 63 L"window.domAutomationController.send(document.execCommand('paste'))";
63 return ExecuteScriptInSelectedTab(kScript, result); 64 return ExecuteScriptInSelectedTab(kScript, result);
64 } 65 }
65 66
66 bool ClipboardApiTest::ExecuteScriptInSelectedTab(const std::wstring& script, 67 bool ClipboardApiTest::ExecuteScriptInSelectedTab(const std::wstring& script,
67 bool* result) { 68 bool* result) {
68 if (!ui_test_utils::ExecuteJavaScriptAndExtractBool( 69 if (!ui_test_utils::ExecuteJavaScriptAndExtractBool(
69 browser()->GetActiveWebContents()->GetRenderViewHost(), 70 chrome::GetActiveWebContents(browser())->GetRenderViewHost(),
70 L"", 71 L"",
71 script, 72 script,
72 result)) { 73 result)) {
73 message_ = "Failed to execute script in selected tab."; 74 message_ = "Failed to execute script in selected tab.";
74 return false; 75 return false;
75 } 76 }
76 return true; 77 return true;
77 } 78 }
78 79
79 } // namespace 80 } // namespace
(...skipping 23 matching lines...) Expand all
103 ASSERT_TRUE(LoadHostedApp("hosted_app_no_permission", "main.html")) 104 ASSERT_TRUE(LoadHostedApp("hosted_app_no_permission", "main.html"))
104 << message_; 105 << message_;
105 106
106 bool result = false; 107 bool result = false;
107 ASSERT_TRUE(ExecuteCopyInSelectedTab(&result)) << message_; 108 ASSERT_TRUE(ExecuteCopyInSelectedTab(&result)) << message_;
108 EXPECT_FALSE(result); 109 EXPECT_FALSE(result);
109 ASSERT_TRUE(ExecutePasteInSelectedTab(&result)) << message_; 110 ASSERT_TRUE(ExecutePasteInSelectedTab(&result)) << message_;
110 EXPECT_FALSE(result); 111 EXPECT_FALSE(result);
111 } 112 }
112 113
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698