| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "components/dom_distiller/core/article_distillation_update.h" | 7 #include "components/dom_distiller/core/article_distillation_update.h" |
| 8 #include "components/dom_distiller/core/test_request_view_handle.h" | 8 #include "components/dom_distiller/core/test_request_view_handle.h" |
| 9 #include "components/pref_registry/testing_pref_service_syncable.h" | 9 #include "components/sync_preferences/testing_pref_service_syncable.h" |
| 10 #include "grit/components_resources.h" | 10 #include "grit/components_resources.h" |
| 11 #include "grit/components_strings.h" | 11 #include "grit/components_strings.h" |
| 12 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
| 15 | 15 |
| 16 using testing::HasSubstr; | 16 using testing::HasSubstr; |
| 17 using testing::Not; | 17 using testing::Not; |
| 18 | 18 |
| 19 namespace dom_distiller { | 19 namespace dom_distiller { |
| 20 | 20 |
| 21 class DomDistillerRequestViewTest : public testing::Test { | 21 class DomDistillerRequestViewTest : public testing::Test { |
| 22 protected: | 22 protected: |
| 23 void SetUp() override { | 23 void SetUp() override { |
| 24 pref_service_.reset(new user_prefs::TestingPrefServiceSyncable()); | 24 pref_service_.reset(new sync_preferences::TestingPrefServiceSyncable()); |
| 25 DistilledPagePrefs::RegisterProfilePrefs(pref_service_->registry()); | 25 DistilledPagePrefs::RegisterProfilePrefs(pref_service_->registry()); |
| 26 distilled_page_prefs_.reset(new DistilledPagePrefs(pref_service_.get())); | 26 distilled_page_prefs_.reset(new DistilledPagePrefs(pref_service_.get())); |
| 27 } | 27 } |
| 28 | 28 |
| 29 std::unique_ptr<user_prefs::TestingPrefServiceSyncable> pref_service_; | 29 std::unique_ptr<sync_preferences::TestingPrefServiceSyncable> pref_service_; |
| 30 std::unique_ptr<DistilledPagePrefs> distilled_page_prefs_; | 30 std::unique_ptr<DistilledPagePrefs> distilled_page_prefs_; |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 TEST_F(DomDistillerRequestViewTest, TestTitleEscaped) { | 33 TEST_F(DomDistillerRequestViewTest, TestTitleEscaped) { |
| 34 const std::string valid_title = "valid title"; | 34 const std::string valid_title = "valid title"; |
| 35 const std::string has_quotes = "\"" + valid_title + "\""; | 35 const std::string has_quotes = "\"" + valid_title + "\""; |
| 36 const std::string escaped_quotes = "\\\"" + valid_title + "\\\""; | 36 const std::string escaped_quotes = "\\\"" + valid_title + "\\\""; |
| 37 const std::string has_special_chars = "<" + valid_title + "\\"; | 37 const std::string has_special_chars = "<" + valid_title + "\\"; |
| 38 const std::string escaped_special_chars = "\\u003C" + valid_title + "\\\\"; | 38 const std::string escaped_special_chars = "\\u003C" + valid_title + "\\\\"; |
| 39 | 39 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 | 219 |
| 220 std::unique_ptr<ArticleDistillationUpdate> article_update( | 220 std::unique_ptr<ArticleDistillationUpdate> article_update( |
| 221 new ArticleDistillationUpdate(pages, true, false)); | 221 new ArticleDistillationUpdate(pages, true, false)); |
| 222 | 222 |
| 223 handle.OnArticleUpdated(*article_update.get()); | 223 handle.OnArticleUpdated(*article_update.get()); |
| 224 | 224 |
| 225 EXPECT_THAT(handle.GetJavaScriptBuffer(), HasSubstr(show_loader)); | 225 EXPECT_THAT(handle.GetJavaScriptBuffer(), HasSubstr(show_loader)); |
| 226 } | 226 } |
| 227 | 227 |
| 228 } // namespace dom_distiller | 228 } // namespace dom_distiller |
| OLD | NEW |