| OLD | NEW |
| 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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 shell()->web_contents()->GetBrowserContext(), | 481 shell()->web_contents()->GetBrowserContext(), |
| 482 GURL("javascript:x=1"), | 482 GURL("javascript:x=1"), |
| 483 nullptr, | 483 nullptr, |
| 484 gfx::Size()); | 484 gfx::Size()); |
| 485 WaitForLoadStop(window->web_contents()); | 485 WaitForLoadStop(window->web_contents()); |
| 486 Attach(); | 486 Attach(); |
| 487 SendCommand("Page.reload", nullptr, false); | 487 SendCommand("Page.reload", nullptr, false); |
| 488 // Should not crash at this point. | 488 // Should not crash at this point. |
| 489 } | 489 } |
| 490 | 490 |
| 491 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, EvaluateInBlankPage) { |
| 492 NavigateToURLBlockUntilNavigationsComplete(shell(), GURL("about:blank"), 1); |
| 493 Attach(); |
| 494 scoped_ptr<base::DictionaryValue> params(new base::DictionaryValue()); |
| 495 params->SetString("expression", "window"); |
| 496 SendCommand("Runtime.evaluate", std::move(params), true); |
| 497 bool wasThrown = true; |
| 498 EXPECT_TRUE(result_->GetBoolean("wasThrown", &wasThrown)); |
| 499 EXPECT_FALSE(wasThrown); |
| 500 } |
| 501 |
| 502 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, |
| 503 EvaluateInBlankPageAfterNavigation) { |
| 504 ASSERT_TRUE(embedded_test_server()->Start()); |
| 505 GURL test_url = embedded_test_server()->GetURL("/devtools/navigation.html"); |
| 506 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 1); |
| 507 Attach(); |
| 508 NavigateToURLBlockUntilNavigationsComplete(shell(), GURL("about:blank"), 1); |
| 509 scoped_ptr<base::DictionaryValue> params(new base::DictionaryValue()); |
| 510 params->SetString("expression", "window"); |
| 511 SendCommand("Runtime.evaluate", std::move(params), true); |
| 512 bool wasThrown = true; |
| 513 EXPECT_TRUE(result_->GetBoolean("wasThrown", &wasThrown)); |
| 514 EXPECT_FALSE(wasThrown); |
| 515 } |
| 516 |
| 491 } // namespace content | 517 } // namespace content |
| OLD | NEW |