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

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

Issue 2403893002: Add layout test for reply property of notificationclick event (Closed)
Patch Set: Make reply field nullable in .idl files; add test cases for empty and null Created 4 years, 2 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 <stddef.h> 7 #include <stddef.h>
8 #include <limits> 8 #include <limits>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/strings/nullable_string16.h"
14 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
15 #include "base/strings/stringprintf.h" 16 #include "base/strings/stringprintf.h"
17 #include "base/strings/utf_string_conversions.h"
16 #include "build/build_config.h" 18 #include "build/build_config.h"
17 #include "components/test_runner/app_banner_client.h" 19 #include "components/test_runner/app_banner_client.h"
18 #include "components/test_runner/layout_and_paint_async_then.h" 20 #include "components/test_runner/layout_and_paint_async_then.h"
19 #include "components/test_runner/layout_dump.h" 21 #include "components/test_runner/layout_dump.h"
20 #include "components/test_runner/mock_content_settings_client.h" 22 #include "components/test_runner/mock_content_settings_client.h"
21 #include "components/test_runner/mock_credential_manager_client.h" 23 #include "components/test_runner/mock_credential_manager_client.h"
22 #include "components/test_runner/mock_screen_orientation_client.h" 24 #include "components/test_runner/mock_screen_orientation_client.h"
23 #include "components/test_runner/mock_web_document_subresource_filter.h" 25 #include "components/test_runner/mock_web_document_subresource_filter.h"
24 #include "components/test_runner/mock_web_speech_recognizer.h" 26 #include "components/test_runner/mock_web_speech_recognizer.h"
25 #include "components/test_runner/mock_web_user_media_client.h" 27 #include "components/test_runner/mock_web_user_media_client.h"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 void SetTabKeyCyclesThroughElements(bool tab_key_cycles_through_elements); 247 void SetTabKeyCyclesThroughElements(bool tab_key_cycles_through_elements);
246 void SetTextDirection(const std::string& direction_name); 248 void SetTextDirection(const std::string& direction_name);
247 void SetTextSubpixelPositioning(bool value); 249 void SetTextSubpixelPositioning(bool value);
248 void SetUseMockTheme(bool use); 250 void SetUseMockTheme(bool use);
249 void SetViewSourceForFrame(const std::string& name, bool enabled); 251 void SetViewSourceForFrame(const std::string& name, bool enabled);
250 void SetWillSendRequestClearHeader(const std::string& header); 252 void SetWillSendRequestClearHeader(const std::string& header);
251 void SetWindowIsKey(bool value); 253 void SetWindowIsKey(bool value);
252 void SetXSSAuditorEnabled(bool enabled); 254 void SetXSSAuditorEnabled(bool enabled);
253 void ShowWebInspector(gin::Arguments* args); 255 void ShowWebInspector(gin::Arguments* args);
254 void SimulateWebNotificationClick(const std::string& title, int action_index); 256 void SimulateWebNotificationClick(const std::string& title, int action_index);
257 void SimulateWebNotificationClickWithReply(const std::string& title,
258 int action_index,
259 const std::string& reply);
255 void SimulateWebNotificationClose(const std::string& title, bool by_user); 260 void SimulateWebNotificationClose(const std::string& title, bool by_user);
256 void UseUnfortunateSynchronousResizeMode(); 261 void UseUnfortunateSynchronousResizeMode();
257 void WaitForPolicyDelegate(); 262 void WaitForPolicyDelegate();
258 void WaitUntilDone(); 263 void WaitUntilDone();
259 void WaitUntilExternalURLLoad(); 264 void WaitUntilExternalURLLoad();
260 void SetMockCredentialManagerError(const std::string& error); 265 void SetMockCredentialManagerError(const std::string& error);
261 void SetMockCredentialManagerResponse(const std::string& id, 266 void SetMockCredentialManagerResponse(const std::string& id,
262 const std::string& name, 267 const std::string& name,
263 const std::string& avatar, 268 const std::string& avatar,
264 const std::string& password); 269 const std::string& password);
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 .SetMethod("setViewSourceForFrame", 574 .SetMethod("setViewSourceForFrame",
570 &TestRunnerBindings::SetViewSourceForFrame) 575 &TestRunnerBindings::SetViewSourceForFrame)
571 .SetMethod("setWillSendRequestClearHeader", 576 .SetMethod("setWillSendRequestClearHeader",
572 &TestRunnerBindings::SetWillSendRequestClearHeader) 577 &TestRunnerBindings::SetWillSendRequestClearHeader)
573 .SetMethod("setWindowIsKey", &TestRunnerBindings::SetWindowIsKey) 578 .SetMethod("setWindowIsKey", &TestRunnerBindings::SetWindowIsKey)
574 .SetMethod("setXSSAuditorEnabled", 579 .SetMethod("setXSSAuditorEnabled",
575 &TestRunnerBindings::SetXSSAuditorEnabled) 580 &TestRunnerBindings::SetXSSAuditorEnabled)
576 .SetMethod("showWebInspector", &TestRunnerBindings::ShowWebInspector) 581 .SetMethod("showWebInspector", &TestRunnerBindings::ShowWebInspector)
577 .SetMethod("simulateWebNotificationClick", 582 .SetMethod("simulateWebNotificationClick",
578 &TestRunnerBindings::SimulateWebNotificationClick) 583 &TestRunnerBindings::SimulateWebNotificationClick)
584 .SetMethod("simulateWebNotificationClickWithReply",
585 &TestRunnerBindings::SimulateWebNotificationClickWithReply)
579 .SetMethod("simulateWebNotificationClose", 586 .SetMethod("simulateWebNotificationClose",
580 &TestRunnerBindings::SimulateWebNotificationClose) 587 &TestRunnerBindings::SimulateWebNotificationClose)
581 .SetProperty("tooltipText", &TestRunnerBindings::TooltipText) 588 .SetProperty("tooltipText", &TestRunnerBindings::TooltipText)
582 .SetMethod("useUnfortunateSynchronousResizeMode", 589 .SetMethod("useUnfortunateSynchronousResizeMode",
583 &TestRunnerBindings::UseUnfortunateSynchronousResizeMode) 590 &TestRunnerBindings::UseUnfortunateSynchronousResizeMode)
584 .SetMethod("waitForPolicyDelegate", 591 .SetMethod("waitForPolicyDelegate",
585 &TestRunnerBindings::WaitForPolicyDelegate) 592 &TestRunnerBindings::WaitForPolicyDelegate)
586 .SetMethod("waitUntilDone", &TestRunnerBindings::WaitUntilDone) 593 .SetMethod("waitUntilDone", &TestRunnerBindings::WaitUntilDone)
587 .SetMethod("waitUntilExternalURLLoad", 594 .SetMethod("waitUntilExternalURLLoad",
588 &TestRunnerBindings::WaitUntilExternalURLLoad) 595 &TestRunnerBindings::WaitUntilExternalURLLoad)
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
1350 1357
1351 void TestRunnerBindings::SetMIDIAccessorResult(bool result) { 1358 void TestRunnerBindings::SetMIDIAccessorResult(bool result) {
1352 if (runner_) 1359 if (runner_)
1353 runner_->SetMIDIAccessorResult(result); 1360 runner_->SetMIDIAccessorResult(result);
1354 } 1361 }
1355 1362
1356 void TestRunnerBindings::SimulateWebNotificationClick(const std::string& title, 1363 void TestRunnerBindings::SimulateWebNotificationClick(const std::string& title,
1357 int action_index) { 1364 int action_index) {
1358 if (!runner_) 1365 if (!runner_)
1359 return; 1366 return;
1360 runner_->SimulateWebNotificationClick(title, action_index); 1367 runner_->SimulateWebNotificationClick(title, action_index,
1368 base::NullableString16());
1369 }
1370
1371 void TestRunnerBindings::SimulateWebNotificationClickWithReply(
1372 const std::string& title,
1373 int action_index,
1374 const std::string& reply) {
1375 if (!runner_)
1376 return;
1377 runner_->SimulateWebNotificationClick(
1378 title, action_index,
1379 base::NullableString16(base::UTF8ToUTF16(reply), false /* is_null */));
1361 } 1380 }
1362 1381
1363 void TestRunnerBindings::SimulateWebNotificationClose(const std::string& title, 1382 void TestRunnerBindings::SimulateWebNotificationClose(const std::string& title,
1364 bool by_user) { 1383 bool by_user) {
1365 if (!runner_) 1384 if (!runner_)
1366 return; 1385 return;
1367 runner_->SimulateWebNotificationClose(title, by_user); 1386 runner_->SimulateWebNotificationClose(title, by_user);
1368 } 1387 }
1369 1388
1370 void TestRunnerBindings::AddMockSpeechRecognitionResult( 1389 void TestRunnerBindings::AddMockSpeechRecognitionResult(
(...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after
2678 } 2697 }
2679 2698
2680 void TestRunner::SetPOSIXLocale(const std::string& locale) { 2699 void TestRunner::SetPOSIXLocale(const std::string& locale) {
2681 delegate_->SetLocale(locale); 2700 delegate_->SetLocale(locale);
2682 } 2701 }
2683 2702
2684 void TestRunner::SetMIDIAccessorResult(bool result) { 2703 void TestRunner::SetMIDIAccessorResult(bool result) {
2685 midi_accessor_result_ = result; 2704 midi_accessor_result_ = result;
2686 } 2705 }
2687 2706
2688 void TestRunner::SimulateWebNotificationClick(const std::string& title, 2707 void TestRunner::SimulateWebNotificationClick(
2689 int action_index) { 2708 const std::string& title,
2690 delegate_->SimulateWebNotificationClick(title, action_index); 2709 int action_index,
2710 const base::NullableString16& reply) {
2711 delegate_->SimulateWebNotificationClick(title, action_index, reply);
2691 } 2712 }
2692 2713
2693 void TestRunner::SimulateWebNotificationClose(const std::string& title, 2714 void TestRunner::SimulateWebNotificationClose(const std::string& title,
2694 bool by_user) { 2715 bool by_user) {
2695 delegate_->SimulateWebNotificationClose(title, by_user); 2716 delegate_->SimulateWebNotificationClose(title, by_user);
2696 } 2717 }
2697 2718
2698 void TestRunner::AddMockSpeechRecognitionResult(const std::string& transcript, 2719 void TestRunner::AddMockSpeechRecognitionResult(const std::string& transcript,
2699 double confidence) { 2720 double confidence) {
2700 getMockWebSpeechRecognizer()->AddMockResult(WebString::fromUTF8(transcript), 2721 getMockWebSpeechRecognizer()->AddMockResult(WebString::fromUTF8(transcript),
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
2770 2791
2771 void TestRunner::NotifyDone() { 2792 void TestRunner::NotifyDone() {
2772 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && 2793 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() &&
2773 !will_navigate_ && work_queue_.is_empty()) 2794 !will_navigate_ && work_queue_.is_empty())
2774 delegate_->TestFinished(); 2795 delegate_->TestFinished();
2775 layout_test_runtime_flags_.set_wait_until_done(false); 2796 layout_test_runtime_flags_.set_wait_until_done(false);
2776 OnLayoutTestRuntimeFlagsChanged(); 2797 OnLayoutTestRuntimeFlagsChanged();
2777 } 2798 }
2778 2799
2779 } // namespace test_runner 2800 } // 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