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

Side by Side Diff: content/shell/renderer/test_runner/test_runner.cc

Issue 395883002: Support layout testing Web Notifications from Document and Worker contexts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: another rebase Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/shell/renderer/test_runner/test_runner.h" 5 #include "content/shell/renderer/test_runner/test_runner.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "content/shell/common/test_runner/test_preferences.h" 10 #include "content/shell/common/test_runner/test_preferences.h"
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 void SetAlwaysAcceptCookies(bool accept); 263 void SetAlwaysAcceptCookies(bool accept);
264 void SetWindowIsKey(bool value); 264 void SetWindowIsKey(bool value);
265 std::string PathToLocalResource(const std::string& path); 265 std::string PathToLocalResource(const std::string& path);
266 void SetBackingScaleFactor(double value, v8::Handle<v8::Function> callback); 266 void SetBackingScaleFactor(double value, v8::Handle<v8::Function> callback);
267 void SetColorProfile(const std::string& name, 267 void SetColorProfile(const std::string& name,
268 v8::Handle<v8::Function> callback); 268 v8::Handle<v8::Function> callback);
269 void SetPOSIXLocale(const std::string& locale); 269 void SetPOSIXLocale(const std::string& locale);
270 void SetMIDIAccessorResult(bool result); 270 void SetMIDIAccessorResult(bool result);
271 void SetMIDISysexPermission(bool value); 271 void SetMIDISysexPermission(bool value);
272 void GrantWebNotificationPermission(gin::Arguments* args); 272 void GrantWebNotificationPermission(gin::Arguments* args);
273 void ClearWebNotificationPermissions();
273 bool SimulateWebNotificationClick(const std::string& value); 274 bool SimulateWebNotificationClick(const std::string& value);
274 void AddMockSpeechRecognitionResult(const std::string& transcript, 275 void AddMockSpeechRecognitionResult(const std::string& transcript,
275 double confidence); 276 double confidence);
276 void SetMockSpeechRecognitionError(const std::string& error, 277 void SetMockSpeechRecognitionError(const std::string& error,
277 const std::string& message); 278 const std::string& message);
278 bool WasMockSpeechRecognitionAborted(); 279 bool WasMockSpeechRecognitionAborted();
279 void AddWebPageOverlay(); 280 void AddWebPageOverlay();
280 void RemoveWebPageOverlay(); 281 void RemoveWebPageOverlay();
281 void DisplayAsync(); 282 void DisplayAsync();
282 void DisplayAsyncThen(v8::Handle<v8::Function> callback); 283 void DisplayAsyncThen(v8::Handle<v8::Function> callback);
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 .SetMethod("setBackingScaleFactor", 510 .SetMethod("setBackingScaleFactor",
510 &TestRunnerBindings::SetBackingScaleFactor) 511 &TestRunnerBindings::SetBackingScaleFactor)
511 .SetMethod("setColorProfile", &TestRunnerBindings::SetColorProfile) 512 .SetMethod("setColorProfile", &TestRunnerBindings::SetColorProfile)
512 .SetMethod("setPOSIXLocale", &TestRunnerBindings::SetPOSIXLocale) 513 .SetMethod("setPOSIXLocale", &TestRunnerBindings::SetPOSIXLocale)
513 .SetMethod("setMIDIAccessorResult", 514 .SetMethod("setMIDIAccessorResult",
514 &TestRunnerBindings::SetMIDIAccessorResult) 515 &TestRunnerBindings::SetMIDIAccessorResult)
515 .SetMethod("setMIDISysexPermission", 516 .SetMethod("setMIDISysexPermission",
516 &TestRunnerBindings::SetMIDISysexPermission) 517 &TestRunnerBindings::SetMIDISysexPermission)
517 .SetMethod("grantWebNotificationPermission", 518 .SetMethod("grantWebNotificationPermission",
518 &TestRunnerBindings::GrantWebNotificationPermission) 519 &TestRunnerBindings::GrantWebNotificationPermission)
520 .SetMethod("clearWebNotificationPermissions",
521 &TestRunnerBindings::ClearWebNotificationPermissions)
519 .SetMethod("simulateWebNotificationClick", 522 .SetMethod("simulateWebNotificationClick",
520 &TestRunnerBindings::SimulateWebNotificationClick) 523 &TestRunnerBindings::SimulateWebNotificationClick)
521 .SetMethod("addMockSpeechRecognitionResult", 524 .SetMethod("addMockSpeechRecognitionResult",
522 &TestRunnerBindings::AddMockSpeechRecognitionResult) 525 &TestRunnerBindings::AddMockSpeechRecognitionResult)
523 .SetMethod("setMockSpeechRecognitionError", 526 .SetMethod("setMockSpeechRecognitionError",
524 &TestRunnerBindings::SetMockSpeechRecognitionError) 527 &TestRunnerBindings::SetMockSpeechRecognitionError)
525 .SetMethod("wasMockSpeechRecognitionAborted", 528 .SetMethod("wasMockSpeechRecognitionAborted",
526 &TestRunnerBindings::WasMockSpeechRecognitionAborted) 529 &TestRunnerBindings::WasMockSpeechRecognitionAborted)
527 .SetMethod("addWebPageOverlay", &TestRunnerBindings::AddWebPageOverlay) 530 .SetMethod("addWebPageOverlay", &TestRunnerBindings::AddWebPageOverlay)
528 .SetMethod("removeWebPageOverlay", 531 .SetMethod("removeWebPageOverlay",
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 if (runner_) 1296 if (runner_)
1294 runner_->SetMIDISysexPermission(value); 1297 runner_->SetMIDISysexPermission(value);
1295 } 1298 }
1296 1299
1297 void TestRunnerBindings::GrantWebNotificationPermission(gin::Arguments* args) { 1300 void TestRunnerBindings::GrantWebNotificationPermission(gin::Arguments* args) {
1298 if (runner_) { 1301 if (runner_) {
1299 std::string origin; 1302 std::string origin;
1300 bool permission_granted = true; 1303 bool permission_granted = true;
1301 args->GetNext(&origin); 1304 args->GetNext(&origin);
1302 args->GetNext(&permission_granted); 1305 args->GetNext(&permission_granted);
1303 return runner_->GrantWebNotificationPermission(origin, permission_granted); 1306 return runner_->GrantWebNotificationPermission(GURL(origin),
1307 permission_granted);
1304 } 1308 }
1305 } 1309 }
1306 1310
1311 void TestRunnerBindings::ClearWebNotificationPermissions() {
1312 if (runner_)
1313 runner_->ClearWebNotificationPermissions();
1314 }
1315
1307 bool TestRunnerBindings::SimulateWebNotificationClick( 1316 bool TestRunnerBindings::SimulateWebNotificationClick(
1308 const std::string& value) { 1317 const std::string& value) {
1309 if (runner_) 1318 if (runner_)
1310 return runner_->SimulateWebNotificationClick(value); 1319 return runner_->SimulateWebNotificationClick(value);
1311 return false; 1320 return false;
1312 } 1321 }
1313 1322
1314 void TestRunnerBindings::AddMockSpeechRecognitionResult( 1323 void TestRunnerBindings::AddMockSpeechRecognitionResult(
1315 const std::string& transcript, double confidence) { 1324 const std::string& transcript, double confidence) {
1316 if (runner_) 1325 if (runner_)
(...skipping 1416 matching lines...) Expand 10 before | Expand all | Expand 10 after
2733 midi_accessor_result_ = result; 2742 midi_accessor_result_ = result;
2734 } 2743 }
2735 2744
2736 void TestRunner::SetMIDISysexPermission(bool value) { 2745 void TestRunner::SetMIDISysexPermission(bool value) {
2737 const std::vector<WebTestProxyBase*>& windowList = 2746 const std::vector<WebTestProxyBase*>& windowList =
2738 test_interfaces_->windowList(); 2747 test_interfaces_->windowList();
2739 for (unsigned i = 0; i < windowList.size(); ++i) 2748 for (unsigned i = 0; i < windowList.size(); ++i)
2740 windowList.at(i)->GetMIDIClientMock()->setSysexPermission(value); 2749 windowList.at(i)->GetMIDIClientMock()->setSysexPermission(value);
2741 } 2750 }
2742 2751
2743 void TestRunner::GrantWebNotificationPermission(const std::string& origin, 2752 void TestRunner::GrantWebNotificationPermission(const GURL& origin,
2744 bool permission_granted) { 2753 bool permission_granted) {
2745 notification_presenter_->GrantPermission(origin, permission_granted); 2754 delegate_->grantWebNotificationPermission(origin, permission_granted);
2755 }
2756
2757 void TestRunner::ClearWebNotificationPermissions() {
2758 delegate_->clearWebNotificationPermissions();
2746 } 2759 }
2747 2760
2748 bool TestRunner::SimulateWebNotificationClick(const std::string& value) { 2761 bool TestRunner::SimulateWebNotificationClick(const std::string& value) {
2749 return notification_presenter_->SimulateClick(value); 2762 return notification_presenter_->SimulateClick(value);
2750 } 2763 }
2751 2764
2752 void TestRunner::AddMockSpeechRecognitionResult(const std::string& transcript, 2765 void TestRunner::AddMockSpeechRecognitionResult(const std::string& transcript,
2753 double confidence) { 2766 double confidence) {
2754 proxy_->GetSpeechRecognizerMock()->addMockResult( 2767 proxy_->GetSpeechRecognizerMock()->addMockResult(
2755 WebString::fromUTF8(transcript), confidence); 2768 WebString::fromUTF8(transcript), confidence);
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
2910 } 2923 }
2911 2924
2912 void TestRunner::DidLosePointerLockInternal() { 2925 void TestRunner::DidLosePointerLockInternal() {
2913 bool was_locked = pointer_locked_; 2926 bool was_locked = pointer_locked_;
2914 pointer_locked_ = false; 2927 pointer_locked_ = false;
2915 if (was_locked) 2928 if (was_locked)
2916 web_view_->didLosePointerLock(); 2929 web_view_->didLosePointerLock();
2917 } 2930 }
2918 2931
2919 } // namespace content 2932 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/renderer/test_runner/test_runner.h ('k') | content/shell/renderer/webkit_test_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698