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

Side by Side Diff: components/test_runner/test_runner.cc

Issue 1262893006: Enable testing NotificationEvent.action (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@click_actions
Patch Set: TestRunnerBindings::SimulateWebNotificationClick throws for non int index Created 5 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 | « components/test_runner/test_runner.h ('k') | components/test_runner/web_test_delegate.h » ('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 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 "components/test_runner/test_runner.h" 5 #include "components/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 "components/test_runner/mock_credential_manager_client.h" 10 #include "components/test_runner/mock_credential_manager_client.h"
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 void ClearAllDatabases(); 266 void ClearAllDatabases();
267 void SetDatabaseQuota(int quota); 267 void SetDatabaseQuota(int quota);
268 void SetAlwaysAcceptCookies(bool accept); 268 void SetAlwaysAcceptCookies(bool accept);
269 void SetWindowIsKey(bool value); 269 void SetWindowIsKey(bool value);
270 std::string PathToLocalResource(const std::string& path); 270 std::string PathToLocalResource(const std::string& path);
271 void SetBackingScaleFactor(double value, v8::Local<v8::Function> callback); 271 void SetBackingScaleFactor(double value, v8::Local<v8::Function> callback);
272 void SetColorProfile(const std::string& name, 272 void SetColorProfile(const std::string& name,
273 v8::Local<v8::Function> callback); 273 v8::Local<v8::Function> callback);
274 void SetPOSIXLocale(const std::string& locale); 274 void SetPOSIXLocale(const std::string& locale);
275 void SetMIDIAccessorResult(bool result); 275 void SetMIDIAccessorResult(bool result);
276 void SimulateWebNotificationClick(const std::string& title); 276 void SimulateWebNotificationClick(gin::Arguments* args);
277 void AddMockSpeechRecognitionResult(const std::string& transcript, 277 void AddMockSpeechRecognitionResult(const std::string& transcript,
278 double confidence); 278 double confidence);
279 void SetMockSpeechRecognitionError(const std::string& error, 279 void SetMockSpeechRecognitionError(const std::string& error,
280 const std::string& message); 280 const std::string& message);
281 bool WasMockSpeechRecognitionAborted(); 281 bool WasMockSpeechRecognitionAborted();
282 void AddMockCredentialManagerResponse(const std::string& id, 282 void AddMockCredentialManagerResponse(const std::string& id,
283 const std::string& name, 283 const std::string& name,
284 const std::string& avatar, 284 const std::string& avatar,
285 const std::string& password); 285 const std::string& password);
286 void AddWebPageOverlay(); 286 void AddWebPageOverlay();
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after
1336 void TestRunnerBindings::SetPOSIXLocale(const std::string& locale) { 1336 void TestRunnerBindings::SetPOSIXLocale(const std::string& locale) {
1337 if (runner_) 1337 if (runner_)
1338 runner_->SetPOSIXLocale(locale); 1338 runner_->SetPOSIXLocale(locale);
1339 } 1339 }
1340 1340
1341 void TestRunnerBindings::SetMIDIAccessorResult(bool result) { 1341 void TestRunnerBindings::SetMIDIAccessorResult(bool result) {
1342 if (runner_) 1342 if (runner_)
1343 runner_->SetMIDIAccessorResult(result); 1343 runner_->SetMIDIAccessorResult(result);
1344 } 1344 }
1345 1345
1346 void TestRunnerBindings::SimulateWebNotificationClick( 1346 void TestRunnerBindings::SimulateWebNotificationClick(gin::Arguments* args) {
1347 const std::string& title) { 1347 if (!runner_)
1348 if (runner_) 1348 return;
1349 runner_->SimulateWebNotificationClick(title); 1349 std::string title;
1350 int action_index = -1;
1351 if (!args->GetNext(&title) ||
1352 !args->PeekNext().IsEmpty() && !args->GetNext(&action_index)) {
Peter Beverloo 2015/08/07 00:11:28 nit: you could rewrite this statement to be easier
johnme 2015/08/07 07:09:54 Done.
1353 args->ThrowError();
1354 return;
1355 }
1356 runner_->SimulateWebNotificationClick(title, action_index);
1350 } 1357 }
1351 1358
1352 void TestRunnerBindings::AddMockSpeechRecognitionResult( 1359 void TestRunnerBindings::AddMockSpeechRecognitionResult(
1353 const std::string& transcript, double confidence) { 1360 const std::string& transcript, double confidence) {
1354 if (runner_) 1361 if (runner_)
1355 runner_->AddMockSpeechRecognitionResult(transcript, confidence); 1362 runner_->AddMockSpeechRecognitionResult(transcript, confidence);
1356 } 1363 }
1357 1364
1358 void TestRunnerBindings::SetMockSpeechRecognitionError( 1365 void TestRunnerBindings::SetMockSpeechRecognitionError(
1359 const std::string& error, const std::string& message) { 1366 const std::string& error, const std::string& message) {
(...skipping 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after
2847 } 2854 }
2848 2855
2849 void TestRunner::SetPOSIXLocale(const std::string& locale) { 2856 void TestRunner::SetPOSIXLocale(const std::string& locale) {
2850 delegate_->SetLocale(locale); 2857 delegate_->SetLocale(locale);
2851 } 2858 }
2852 2859
2853 void TestRunner::SetMIDIAccessorResult(bool result) { 2860 void TestRunner::SetMIDIAccessorResult(bool result) {
2854 midi_accessor_result_ = result; 2861 midi_accessor_result_ = result;
2855 } 2862 }
2856 2863
2857 void TestRunner::SimulateWebNotificationClick(const std::string& title) { 2864 void TestRunner::SimulateWebNotificationClick(const std::string& title,
2858 delegate_->SimulateWebNotificationClick(title); 2865 int action_index) {
2866 delegate_->SimulateWebNotificationClick(title, action_index);
2859 } 2867 }
2860 2868
2861 void TestRunner::AddMockSpeechRecognitionResult(const std::string& transcript, 2869 void TestRunner::AddMockSpeechRecognitionResult(const std::string& transcript,
2862 double confidence) { 2870 double confidence) {
2863 proxy_->GetSpeechRecognizerMock()->AddMockResult( 2871 proxy_->GetSpeechRecognizerMock()->AddMockResult(
2864 WebString::fromUTF8(transcript), confidence); 2872 WebString::fromUTF8(transcript), confidence);
2865 } 2873 }
2866 2874
2867 void TestRunner::SetMockSpeechRecognitionError(const std::string& error, 2875 void TestRunner::SetMockSpeechRecognitionError(const std::string& error,
2868 const std::string& message) { 2876 const std::string& message) {
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
3061 } 3069 }
3062 3070
3063 void TestRunner::DidLosePointerLockInternal() { 3071 void TestRunner::DidLosePointerLockInternal() {
3064 bool was_locked = pointer_locked_; 3072 bool was_locked = pointer_locked_;
3065 pointer_locked_ = false; 3073 pointer_locked_ = false;
3066 if (was_locked) 3074 if (was_locked)
3067 web_view_->didLosePointerLock(); 3075 web_view_->didLosePointerLock();
3068 } 3076 }
3069 3077
3070 } // namespace test_runner 3078 } // namespace test_runner
OLDNEW
« no previous file with comments | « components/test_runner/test_runner.h ('k') | components/test_runner/web_test_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698