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

Side by Side Diff: chrome/test/nacl/nacl_browsertest_util.cc

Issue 286243003: Move JavascriptTestObserver from chrome to content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unnecessary content prefixes Created 6 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 | « chrome/test/nacl/nacl_browsertest_util.h ('k') | chrome/test/nacl/pnacl_header_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/test/nacl/nacl_browsertest_util.h" 5 #include "chrome/test/nacl/nacl_browsertest_util.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/tabs/tab_strip_model.h" 13 #include "chrome/browser/ui/tabs/tab_strip_model.h"
14 #include "chrome/common/chrome_paths.h" 14 #include "chrome/common/chrome_paths.h"
15 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
16 #include "chrome/test/base/ui_test_utils.h" 16 #include "chrome/test/base/ui_test_utils.h"
17 #include "components/nacl/common/nacl_switches.h" 17 #include "components/nacl/common/nacl_switches.h"
18 #include "content/public/browser/plugin_service.h" 18 #include "content/public/browser/plugin_service.h"
19 #include "content/public/browser/web_contents.h" 19 #include "content/public/browser/web_contents.h"
20 #include "content/public/common/webplugininfo.h" 20 #include "content/public/common/webplugininfo.h"
21 #include "net/base/net_util.h" 21 #include "net/base/net_util.h"
22 22
23 typedef TestMessageHandler::MessageResponse MessageResponse; 23 typedef content::TestMessageHandler::MessageResponse MessageResponse;
24 24
25 MessageResponse StructuredMessageHandler::HandleMessage( 25 MessageResponse StructuredMessageHandler::HandleMessage(
26 const std::string& json) { 26 const std::string& json) {
27 scoped_ptr<base::Value> value; 27 scoped_ptr<base::Value> value;
28 base::JSONReader reader(base::JSON_ALLOW_TRAILING_COMMAS); 28 base::JSONReader reader(base::JSON_ALLOW_TRAILING_COMMAS);
29 // Automation messages are stringified before they are sent because the 29 // Automation messages are stringified before they are sent because the
30 // automation channel cannot handle arbitrary objects. This means we 30 // automation channel cannot handle arbitrary objects. This means we
31 // need to decode the json twice to get the original message. 31 // need to decode the json twice to get the original message.
32 value.reset(reader.ReadToValue(json)); 32 value.reset(reader.ReadToValue(json));
33 if (!value.get()) 33 if (!value.get())
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 return false; 227 return false;
228 } 228 }
229 229
230 GURL NaClBrowserTestBase::TestURL( 230 GURL NaClBrowserTestBase::TestURL(
231 const base::FilePath::StringType& url_fragment) { 231 const base::FilePath::StringType& url_fragment) {
232 base::FilePath expanded_url = base::FilePath(FILE_PATH_LITERAL("files")); 232 base::FilePath expanded_url = base::FilePath(FILE_PATH_LITERAL("files"));
233 expanded_url = expanded_url.Append(url_fragment); 233 expanded_url = expanded_url.Append(url_fragment);
234 return test_server_->GetURL(expanded_url.MaybeAsASCII()); 234 return test_server_->GetURL(expanded_url.MaybeAsASCII());
235 } 235 }
236 236
237 bool NaClBrowserTestBase::RunJavascriptTest(const GURL& url, 237 bool NaClBrowserTestBase::RunJavascriptTest(
238 TestMessageHandler* handler) { 238 const GURL& url,
239 JavascriptTestObserver observer( 239 content::TestMessageHandler* handler) {
240 content::JavascriptTestObserver observer(
240 browser()->tab_strip_model()->GetActiveWebContents(), 241 browser()->tab_strip_model()->GetActiveWebContents(),
241 handler); 242 handler);
242 ui_test_utils::NavigateToURL(browser(), url); 243 ui_test_utils::NavigateToURL(browser(), url);
243 return observer.Run(); 244 return observer.Run();
244 } 245 }
245 246
246 void NaClBrowserTestBase::RunLoadTest( 247 void NaClBrowserTestBase::RunLoadTest(
247 const base::FilePath::StringType& test_file) { 248 const base::FilePath::StringType& test_file) {
248 LoadTestMessageHandler handler; 249 LoadTestMessageHandler handler;
249 base::FilePath::StringType test_file_with_pnacl = test_file; 250 base::FilePath::StringType test_file_with_pnacl = test_file;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 342
342 base::FilePath::StringType NaClBrowserTestPnaclNonSfi::Variant() { 343 base::FilePath::StringType NaClBrowserTestPnaclNonSfi::Variant() {
343 return FILE_PATH_LITERAL("nonsfi"); 344 return FILE_PATH_LITERAL("nonsfi");
344 } 345 }
345 346
346 void NaClBrowserTestPnaclNonSfi::SetUpCommandLine( 347 void NaClBrowserTestPnaclNonSfi::SetUpCommandLine(
347 base::CommandLine* command_line) { 348 base::CommandLine* command_line) {
348 NaClBrowserTestBase::SetUpCommandLine(command_line); 349 NaClBrowserTestBase::SetUpCommandLine(command_line);
349 command_line->AppendSwitch(switches::kEnableNaClNonSfiMode); 350 command_line->AppendSwitch(switches::kEnableNaClNonSfiMode);
350 } 351 }
OLDNEW
« no previous file with comments | « chrome/test/nacl/nacl_browsertest_util.h ('k') | chrome/test/nacl/pnacl_header_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698