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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 pak_file, ui::SCALE_FACTOR_NONE); | 127 pak_file, ui::SCALE_FACTOR_NONE); |
128 } | 128 } |
129 | 129 |
130 void SetUpTestServer() { | 130 void SetUpTestServer() { |
131 base::FilePath path; | 131 base::FilePath path; |
132 PathService::Get(base::DIR_SOURCE_ROOT, &path); | 132 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
133 embedded_test_server()->ServeFilesFromDirectory( | 133 embedded_test_server()->ServeFilesFromDirectory( |
134 path.AppendASCII("components/test/data/dom_distiller")); | 134 path.AppendASCII("components/test/data/dom_distiller")); |
135 embedded_test_server()->ServeFilesFromDirectory( | 135 embedded_test_server()->ServeFilesFromDirectory( |
136 path.AppendASCII("components/dom_distiller/core/javascript")); | 136 path.AppendASCII("components/dom_distiller/core/javascript")); |
137 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 137 ASSERT_TRUE(embedded_test_server()->Start()); |
138 } | 138 } |
139 | 139 |
140 protected: | 140 protected: |
141 void RunUseCurrentWebContentsTest(const std::string& url, | 141 void RunUseCurrentWebContentsTest(const std::string& url, |
142 bool expect_new_web_contents, | 142 bool expect_new_web_contents, |
143 bool setup_main_frame_observer, | 143 bool setup_main_frame_observer, |
144 bool wait_for_document_loaded); | 144 bool wait_for_document_loaded); |
145 | 145 |
146 DistillerPageWebContents* distiller_page_; | 146 DistillerPageWebContents* distiller_page_; |
147 scoped_ptr<proto::DomDistillerResult> distiller_result_; | 147 scoped_ptr<proto::DomDistillerResult> distiller_result_; |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |