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

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

Issue 9015022: Replace most of Browser::GetSelectedTabContents calls into Browser::GetSelectedWebContents. I've ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 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) 2011 The Chromium Authors. All rights reserved. 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 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/test/base/ui_test_utils.h" 8 #include "chrome/test/base/ui_test_utils.h"
9 #include "content/browser/tab_contents/tab_contents.h" 9 #include "content/public/browser/web_contents.h"
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
11 #include "net/base/mock_host_resolver.h" 11 #include "net/base/mock_host_resolver.h"
12 12
13 namespace { 13 namespace {
14 14
15 class ClipboardApiTest : public ExtensionApiTest { 15 class ClipboardApiTest : public ExtensionApiTest {
16 public: 16 public:
17 bool LoadHostedApp(const std::string& app_name, 17 bool LoadHostedApp(const std::string& app_name,
18 const std::string& launch_page); 18 const std::string& launch_page);
19 bool ExecuteCopyInSelectedTab(bool* result); 19 bool ExecuteCopyInSelectedTab(bool* result);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 bool ClipboardApiTest::ExecutePasteInSelectedTab(bool* result) { 60 bool ClipboardApiTest::ExecutePasteInSelectedTab(bool* result) {
61 const wchar_t kScript[] = 61 const wchar_t kScript[] =
62 L"window.domAutomationController.send(document.execCommand('paste'))"; 62 L"window.domAutomationController.send(document.execCommand('paste'))";
63 return ExecuteScriptInSelectedTab(kScript, result); 63 return ExecuteScriptInSelectedTab(kScript, result);
64 } 64 }
65 65
66 bool ClipboardApiTest::ExecuteScriptInSelectedTab(const std::wstring& script, 66 bool ClipboardApiTest::ExecuteScriptInSelectedTab(const std::wstring& script,
67 bool* result) { 67 bool* result) {
68 if (!ui_test_utils::ExecuteJavaScriptAndExtractBool( 68 if (!ui_test_utils::ExecuteJavaScriptAndExtractBool(
69 browser()->GetSelectedTabContents()->GetRenderViewHost(), 69 browser()->GetSelectedWebContents()->GetRenderViewHost(),
70 L"", 70 L"",
71 script, 71 script,
72 result)) { 72 result)) {
73 message_ = "Failed to execute script in selected tab."; 73 message_ = "Failed to execute script in selected tab.";
74 return false; 74 return false;
75 } 75 }
76 return true; 76 return true;
77 } 77 }
78 78
79 } // namespace 79 } // namespace
(...skipping 23 matching lines...) Expand all
103 ASSERT_TRUE(LoadHostedApp("hosted_app_no_permission", "main.html")) 103 ASSERT_TRUE(LoadHostedApp("hosted_app_no_permission", "main.html"))
104 << message_; 104 << message_;
105 105
106 bool result = false; 106 bool result = false;
107 ASSERT_TRUE(ExecuteCopyInSelectedTab(&result)) << message_; 107 ASSERT_TRUE(ExecuteCopyInSelectedTab(&result)) << message_;
108 EXPECT_FALSE(result); 108 EXPECT_FALSE(result);
109 ASSERT_TRUE(ExecutePasteInSelectedTab(&result)) << message_; 109 ASSERT_TRUE(ExecutePasteInSelectedTab(&result)) << message_;
110 EXPECT_FALSE(result); 110 EXPECT_FALSE(result);
111 } 111 }
112 112
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698