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

Side by Side Diff: chrome/test/webdriver/webdriver_session.cc

Issue 10834004: Correct const accessors in base/values.(h|cc) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Reverting webdriver:Command::parameters_ to const Created 8 years, 4 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
« no previous file with comments | « chrome/test/webdriver/webdriver_session.h ('k') | chromeos/dbus/flimflam_device_client.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/webdriver/webdriver_session.h" 5 #include "chrome/test/webdriver/webdriver_session.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 Error* error = NULL; 569 Error* error = NULL;
570 RunSessionTask(base::Bind( 570 RunSessionTask(base::Bind(
571 &Automation::DeleteCookie, 571 &Automation::DeleteCookie,
572 base::Unretained(automation_.get()), 572 base::Unretained(automation_.get()),
573 url, 573 url,
574 cookie_name, 574 cookie_name,
575 &error)); 575 &error));
576 return error; 576 return error;
577 } 577 }
578 578
579 // Note that when this is called from CookieCommand::ExecutePost then
580 // |cookie_dict| is destroyed as soon as the caller finishes. Therefore
581 // it is essential that RunSessionTask executes synchronously.
579 Error* Session::SetCookie(const std::string& url, 582 Error* Session::SetCookie(const std::string& url,
580 DictionaryValue* cookie_dict) { 583 DictionaryValue* cookie_dict) {
581 Error* error = NULL; 584 Error* error = NULL;
582 RunSessionTask(base::Bind( 585 RunSessionTask(base::Bind(
583 &Automation::SetCookie, 586 &Automation::SetCookie,
584 base::Unretained(automation_.get()), 587 base::Unretained(automation_.get()),
585 url, 588 url,
586 cookie_dict, 589 cookie_dict,
587 &error)); 590 &error));
588 return error; 591 return error;
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
1357 type == kLocalStorageType ? atoms::REMOVE_LOCAL_STORAGE_ITEM 1360 type == kLocalStorageType ? atoms::REMOVE_LOCAL_STORAGE_ITEM
1358 : atoms::REMOVE_SESSION_STORAGE_ITEM); 1361 : atoms::REMOVE_SESSION_STORAGE_ITEM);
1359 return ExecuteScriptAndParse( 1362 return ExecuteScriptAndParse(
1360 current_target_, 1363 current_target_,
1361 js, 1364 js,
1362 "removeStorageItem", 1365 "removeStorageItem",
1363 CreateListValueFrom(key), 1366 CreateListValueFrom(key),
1364 CreateDirectValueParser(value)); 1367 CreateDirectValueParser(value));
1365 } 1368 }
1366 1369
1367 Error* Session::GetGeolocation(scoped_ptr<base::DictionaryValue>* geolocation) { 1370 Error* Session::GetGeolocation(
1371 scoped_ptr<base::DictionaryValue>* geolocation) {
1368 Error* error = NULL; 1372 Error* error = NULL;
1369 RunSessionTask(base::Bind( 1373 RunSessionTask(base::Bind(
1370 &Automation::GetGeolocation, 1374 &Automation::GetGeolocation,
1371 base::Unretained(automation_.get()), 1375 base::Unretained(automation_.get()),
1372 geolocation, 1376 geolocation,
1373 &error)); 1377 &error));
1374 return error; 1378 return error;
1375 } 1379 }
1376 1380
1377 Error* Session::OverrideGeolocation(base::DictionaryValue* geolocation) { 1381 Error* Session::OverrideGeolocation(const base::DictionaryValue* geolocation) {
1378 Error* error = NULL; 1382 Error* error = NULL;
1379 RunSessionTask(base::Bind( 1383 RunSessionTask(base::Bind(
1380 &Automation::OverrideGeolocation, 1384 &Automation::OverrideGeolocation,
1381 base::Unretained(automation_.get()), 1385 base::Unretained(automation_.get()),
1382 geolocation, 1386 geolocation,
1383 &error)); 1387 &error));
1384 return error; 1388 return error;
1385 } 1389 }
1386 1390
1387 const std::string& Session::id() const { 1391 const std::string& Session::id() const {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1424 return capabilities_; 1428 return capabilities_;
1425 } 1429 }
1426 1430
1427 void Session::RunSessionTask(const base::Closure& task) { 1431 void Session::RunSessionTask(const base::Closure& task) {
1428 base::WaitableEvent done_event(false, false); 1432 base::WaitableEvent done_event(false, false);
1429 thread_.message_loop_proxy()->PostTask(FROM_HERE, base::Bind( 1433 thread_.message_loop_proxy()->PostTask(FROM_HERE, base::Bind(
1430 &Session::RunClosureOnSessionThread, 1434 &Session::RunClosureOnSessionThread,
1431 base::Unretained(this), 1435 base::Unretained(this),
1432 task, 1436 task,
1433 &done_event)); 1437 &done_event));
1438 // See SetCookie for why it is essential that we wait here.
1434 done_event.Wait(); 1439 done_event.Wait();
1435 } 1440 }
1436 1441
1437 void Session::RunClosureOnSessionThread(const base::Closure& task, 1442 void Session::RunClosureOnSessionThread(const base::Closure& task,
1438 base::WaitableEvent* done_event) { 1443 base::WaitableEvent* done_event) {
1439 task.Run(); 1444 task.Run();
1440 done_event->Signal(); 1445 done_event->Signal();
1441 } 1446 }
1442 1447
1443 void Session::InitOnSessionThread(const Automation::BrowserOptions& options, 1448 void Session::InitOnSessionThread(const Automation::BrowserOptions& options,
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
1922 capabilities_.local_state->GetWithoutPathExpansion(*iter, &value); 1927 capabilities_.local_state->GetWithoutPathExpansion(*iter, &value);
1923 Error* error = SetPreference(*iter, false /* is_user_pref */, 1928 Error* error = SetPreference(*iter, false /* is_user_pref */,
1924 value->DeepCopy()); 1929 value->DeepCopy());
1925 if (error) 1930 if (error)
1926 return error; 1931 return error;
1927 } 1932 }
1928 return NULL; 1933 return NULL;
1929 } 1934 }
1930 1935
1931 } // namespace webdriver 1936 } // namespace webdriver
OLDNEW
« no previous file with comments | « chrome/test/webdriver/webdriver_session.h ('k') | chromeos/dbus/flimflam_device_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698