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

Side by Side Diff: content/browser/devtools/protocol/devtools_protocol_browsertest.cc

Issue 2234983002: [DevTools] Removed wasThrown from evaluate-like protocol methods (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: a Created 4 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 | « no previous file | third_party/WebKit/LayoutTests/http/tests/inspector-enabled/injected-script-discard.html » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <stddef.h> 5 #include <stddef.h>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/base64.h" 8 #include "base/base64.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 SendCommand("Page.reload", nullptr, false); 645 SendCommand("Page.reload", nullptr, false);
646 // Should not crash at this point. 646 // Should not crash at this point.
647 } 647 }
648 648
649 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, EvaluateInBlankPage) { 649 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, EvaluateInBlankPage) {
650 NavigateToURLBlockUntilNavigationsComplete(shell(), GURL("about:blank"), 1); 650 NavigateToURLBlockUntilNavigationsComplete(shell(), GURL("about:blank"), 1);
651 Attach(); 651 Attach();
652 std::unique_ptr<base::DictionaryValue> params(new base::DictionaryValue()); 652 std::unique_ptr<base::DictionaryValue> params(new base::DictionaryValue());
653 params->SetString("expression", "window"); 653 params->SetString("expression", "window");
654 SendCommand("Runtime.evaluate", std::move(params), true); 654 SendCommand("Runtime.evaluate", std::move(params), true);
655 bool wasThrown = true; 655 EXPECT_FALSE(result_->HasKey("exceptionDetails"));
656 EXPECT_TRUE(result_->GetBoolean("wasThrown", &wasThrown));
657 EXPECT_FALSE(wasThrown);
658 } 656 }
659 657
660 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, 658 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest,
661 EvaluateInBlankPageAfterNavigation) { 659 EvaluateInBlankPageAfterNavigation) {
662 ASSERT_TRUE(embedded_test_server()->Start()); 660 ASSERT_TRUE(embedded_test_server()->Start());
663 GURL test_url = embedded_test_server()->GetURL("/devtools/navigation.html"); 661 GURL test_url = embedded_test_server()->GetURL("/devtools/navigation.html");
664 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 1); 662 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 1);
665 Attach(); 663 Attach();
666 NavigateToURLBlockUntilNavigationsComplete(shell(), GURL("about:blank"), 1); 664 NavigateToURLBlockUntilNavigationsComplete(shell(), GURL("about:blank"), 1);
667 std::unique_ptr<base::DictionaryValue> params(new base::DictionaryValue()); 665 std::unique_ptr<base::DictionaryValue> params(new base::DictionaryValue());
668 params->SetString("expression", "window"); 666 params->SetString("expression", "window");
669 SendCommand("Runtime.evaluate", std::move(params), true); 667 SendCommand("Runtime.evaluate", std::move(params), true);
670 bool wasThrown = true; 668 EXPECT_FALSE(result_->HasKey("exceptionDetails"));
671 EXPECT_TRUE(result_->GetBoolean("wasThrown", &wasThrown));
672 EXPECT_FALSE(wasThrown);
673 } 669 }
674 670
675 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, JavaScriptDialogNotifications) { 671 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, JavaScriptDialogNotifications) {
676 NavigateToURLBlockUntilNavigationsComplete(shell(), GURL("about:blank"), 1); 672 NavigateToURLBlockUntilNavigationsComplete(shell(), GURL("about:blank"), 1);
677 Attach(); 673 Attach();
678 TestJavaScriptDialogManager dialog_manager; 674 TestJavaScriptDialogManager dialog_manager;
679 shell()->web_contents()->SetDelegate(&dialog_manager); 675 shell()->web_contents()->SetDelegate(&dialog_manager);
680 SendCommand("Page.enable", nullptr, true); 676 SendCommand("Page.enable", nullptr, true);
681 std::unique_ptr<base::DictionaryValue> params(new base::DictionaryValue()); 677 std::unique_ptr<base::DictionaryValue> params(new base::DictionaryValue());
682 params->SetString("expression", "alert('alert')"); 678 params->SetString("expression", "alert('alert')");
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 params->SetString("policy", "advance"); 877 params->SetString("policy", "advance");
882 params->SetInteger("budget", 1000); 878 params->SetInteger("budget", 1000);
883 SendCommand("Emulation.setVirtualTimePolicy", std::move(params), true); 879 SendCommand("Emulation.setVirtualTimePolicy", std::move(params), true);
884 880
885 WaitForNotification("Emulation.virtualTimeBudgetExpired"); 881 WaitForNotification("Emulation.virtualTimeBudgetExpired");
886 882
887 EXPECT_THAT(console_messages_, ElementsAre("before", "done", "after")); 883 EXPECT_THAT(console_messages_, ElementsAre("before", "done", "after"));
888 } 884 }
889 885
890 } // namespace content 886 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/inspector-enabled/injected-script-discard.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698