| 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 "base/memory/weak_ptr.h" | 5 #include "base/memory/weak_ptr.h" | 
| 6 #include "base/path_service.h" | 6 #include "base/path_service.h" | 
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" | 
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" | 
| 9 #include "base/values.h" | 9 #include "base/values.h" | 
| 10 #include "components/dom_distiller/content/browser/distiller_javascript_utils.h" | 10 #include "components/dom_distiller/content/browser/distiller_javascript_utils.h" | 
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 497                                                true); | 497                                                true); | 
| 498   web_contents->GetController().LoadURL( | 498   web_contents->GetController().LoadURL( | 
| 499       embedded_test_server()->GetURL("/pinch_tester.html"), | 499       embedded_test_server()->GetURL("/pinch_tester.html"), | 
| 500       content::Referrer(), | 500       content::Referrer(), | 
| 501       ui::PAGE_TRANSITION_TYPED, | 501       ui::PAGE_TRANSITION_TYPED, | 
| 502       std::string()); | 502       std::string()); | 
| 503   url_loaded_runner.Run(); | 503   url_loaded_runner.Run(); | 
| 504 | 504 | 
| 505   // Execute the JS to run the tests, and wait until it has finished. | 505   // Execute the JS to run the tests, and wait until it has finished. | 
| 506   base::RunLoop run_loop; | 506   base::RunLoop run_loop; | 
| 507   web_contents->GetMainFrame()->ExecuteJavaScript( | 507   web_contents->GetMainFrame()->ExecuteJavaScriptForTests( | 
| 508       base::UTF8ToUTF16("(function() {return pinchtest.run();})();"), | 508       base::UTF8ToUTF16("(function() {return pinchtest.run();})();"), | 
| 509       base::Bind(&DistillerPageWebContentsTest::OnJsExecutionDone, | 509       base::Bind(&DistillerPageWebContentsTest::OnJsExecutionDone, | 
| 510                  base::Unretained(this), run_loop.QuitClosure())); | 510                  base::Unretained(this), run_loop.QuitClosure())); | 
| 511   run_loop.Run(); | 511   run_loop.Run(); | 
| 512 | 512 | 
| 513   // Convert to dictionary and parse the results. | 513   // Convert to dictionary and parse the results. | 
| 514   const base::DictionaryValue* dict; | 514   const base::DictionaryValue* dict; | 
| 515   ASSERT_TRUE(js_result_); | 515   ASSERT_TRUE(js_result_); | 
| 516   ASSERT_TRUE(js_result_->GetAsDictionary(&dict)); | 516   ASSERT_TRUE(js_result_->GetAsDictionary(&dict)); | 
| 517 | 517 | 
| 518   ASSERT_TRUE(dict->HasKey("success")); | 518   ASSERT_TRUE(dict->HasKey("success")); | 
| 519   bool success; | 519   bool success; | 
| 520   ASSERT_TRUE(dict->GetBoolean("success", &success)); | 520   ASSERT_TRUE(dict->GetBoolean("success", &success)); | 
| 521   EXPECT_TRUE(success); | 521   EXPECT_TRUE(success); | 
| 522 } | 522 } | 
| 523 | 523 | 
| 524 }  // namespace dom_distiller | 524 }  // namespace dom_distiller | 
| OLD | NEW | 
|---|