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

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

Issue 11753009: Simplify ExecuteJavaScript* functions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update prerender_browsertest.cc. Created 7 years, 11 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/browser/ui/browser_tabstrip.h"
9 #include "chrome/test/base/ui_test_utils.h" 9 #include "chrome/test/base/ui_test_utils.h"
10 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 } 60 }
61 61
62 bool ClipboardApiTest::ExecutePasteInSelectedTab(bool* result) { 62 bool ClipboardApiTest::ExecutePasteInSelectedTab(bool* result) {
63 const char kScript[] = 63 const char kScript[] =
64 "window.domAutomationController.send(document.execCommand('paste'))"; 64 "window.domAutomationController.send(document.execCommand('paste'))";
65 return ExecuteScriptInSelectedTab(kScript, result); 65 return ExecuteScriptInSelectedTab(kScript, result);
66 } 66 }
67 67
68 bool ClipboardApiTest::ExecuteScriptInSelectedTab(const std::string& script, 68 bool ClipboardApiTest::ExecuteScriptInSelectedTab(const std::string& script,
69 bool* result) { 69 bool* result) {
70 if (!content::ExecuteJavaScriptAndExtractBool( 70 if (!content::ExecuteScriptAndExtractBool(
71 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), 71 chrome::GetActiveWebContents(browser()),
72 "",
73 script, 72 script,
74 result)) { 73 result)) {
75 message_ = "Failed to execute script in selected tab."; 74 message_ = "Failed to execute script in selected tab.";
76 return false; 75 return false;
77 } 76 }
78 return true; 77 return true;
79 } 78 }
80 79
81 } // namespace 80 } // namespace
82 81
(...skipping 22 matching lines...) Expand all
105 ASSERT_TRUE(LoadHostedApp("hosted_app_no_permission", "main.html")) 104 ASSERT_TRUE(LoadHostedApp("hosted_app_no_permission", "main.html"))
106 << message_; 105 << message_;
107 106
108 bool result = false; 107 bool result = false;
109 ASSERT_TRUE(ExecuteCopyInSelectedTab(&result)) << message_; 108 ASSERT_TRUE(ExecuteCopyInSelectedTab(&result)) << message_;
110 EXPECT_FALSE(result); 109 EXPECT_FALSE(result);
111 ASSERT_TRUE(ExecutePasteInSelectedTab(&result)) << message_; 110 ASSERT_TRUE(ExecutePasteInSelectedTab(&result)) << message_;
112 EXPECT_FALSE(result); 111 EXPECT_FALSE(result);
113 } 112 }
114 113
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_browsertest.cc ('k') | chrome/browser/extensions/extension_icon_source_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698