| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <string.h> | 5 #include <string.h> |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 162 |
| 163 FakeDB<ArticleEntry>::EntryMap* | 163 FakeDB<ArticleEntry>::EntryMap* |
| 164 DomDistillerViewerSourceBrowserTest::database_model_; | 164 DomDistillerViewerSourceBrowserTest::database_model_; |
| 165 bool DomDistillerViewerSourceBrowserTest::expect_distillation_ = false; | 165 bool DomDistillerViewerSourceBrowserTest::expect_distillation_ = false; |
| 166 bool DomDistillerViewerSourceBrowserTest::expect_distiller_page_ = false; | 166 bool DomDistillerViewerSourceBrowserTest::expect_distiller_page_ = false; |
| 167 MockDistillerFactory* DomDistillerViewerSourceBrowserTest::distiller_factory_ = | 167 MockDistillerFactory* DomDistillerViewerSourceBrowserTest::distiller_factory_ = |
| 168 NULL; | 168 NULL; |
| 169 | 169 |
| 170 // The DomDistillerViewerSource renders untrusted content, so ensure no bindings | 170 // The DomDistillerViewerSource renders untrusted content, so ensure no bindings |
| 171 // are enabled when the article exists in the database. | 171 // are enabled when the article exists in the database. |
| 172 // Flaky on Linux Debug, see http://crbug.com/605432. | |
| 173 #if defined(OS_LINUX) && !defined(NDEBUG) | |
| 174 #define MAYBE_NoWebUIBindingsArticleExists DISABLED_NoWebUIBindingsArticleExists | |
| 175 #else | |
| 176 #define MAYBE_NoWebUIBindingsArticleExists NoWebUIBindingsArticleExists | |
| 177 #endif | |
| 178 IN_PROC_BROWSER_TEST_F(DomDistillerViewerSourceBrowserTest, | 172 IN_PROC_BROWSER_TEST_F(DomDistillerViewerSourceBrowserTest, |
| 179 MAYBE_NoWebUIBindingsArticleExists) { | 173 NoWebUIBindingsArticleExists) { |
| 180 // Ensure there is one item in the database, which will trigger distillation. | 174 // Ensure there is one item in the database, which will trigger distillation. |
| 181 const ArticleEntry entry = CreateEntry("DISTILLED", "http://example.com/1"); | 175 const ArticleEntry entry = CreateEntry("DISTILLED", "http://example.com/1"); |
| 182 AddEntry(entry, database_model_); | 176 AddEntry(entry, database_model_); |
| 183 expect_distillation_ = true; | 177 expect_distillation_ = true; |
| 184 expect_distiller_page_ = true; | 178 expect_distiller_page_ = true; |
| 185 const GURL url = url_utils::GetDistillerViewUrlFromEntryId( | 179 const GURL url = url_utils::GetDistillerViewUrlFromEntryId( |
| 186 kDomDistillerScheme, entry.entry_id()); | 180 kDomDistillerScheme, entry.entry_id()); |
| 187 ViewSingleDistilledPage(url, "text/html"); | 181 ViewSingleDistilledPage(url, "text/html"); |
| 188 } | 182 } |
| 189 | 183 |
| 190 // The DomDistillerViewerSource renders untrusted content, so ensure no bindings | 184 // The DomDistillerViewerSource renders untrusted content, so ensure no bindings |
| 191 // are enabled when the article is not found. | 185 // are enabled when the article is not found. |
| 192 // Flaky on Linux Debug, see http://crbug.com/605432. | |
| 193 #if defined(OS_LINUX) && !defined(NDEBUG) | |
| 194 #define MAYBE_NoWebUIBindingsArticleNotFound DISABLED_NoWebUIBindingsArticleNotF
ound | |
| 195 #else | |
| 196 #define MAYBE_NoWebUIBindingsArticleNotFound NoWebUIBindingsArticleNotFound | |
| 197 #endif | |
| 198 IN_PROC_BROWSER_TEST_F(DomDistillerViewerSourceBrowserTest, | 186 IN_PROC_BROWSER_TEST_F(DomDistillerViewerSourceBrowserTest, |
| 199 MAYBE_NoWebUIBindingsArticleNotFound) { | 187 NoWebUIBindingsArticleNotFound) { |
| 200 // The article does not exist, so assume no distillation will happen. | 188 // The article does not exist, so assume no distillation will happen. |
| 201 expect_distillation_ = false; | 189 expect_distillation_ = false; |
| 202 expect_distiller_page_ = false; | 190 expect_distiller_page_ = false; |
| 203 const GURL url = url_utils::GetDistillerViewUrlFromEntryId( | 191 const GURL url = url_utils::GetDistillerViewUrlFromEntryId( |
| 204 kDomDistillerScheme, "DOES_NOT_EXIST"); | 192 kDomDistillerScheme, "DOES_NOT_EXIST"); |
| 205 ViewSingleDistilledPage(url, "text/html"); | 193 ViewSingleDistilledPage(url, "text/html"); |
| 206 } | 194 } |
| 207 | 195 |
| 208 // The DomDistillerViewerSource renders untrusted content, so ensure no bindings | 196 // The DomDistillerViewerSource renders untrusted content, so ensure no bindings |
| 209 // are enabled when requesting to view an arbitrary URL. | 197 // are enabled when requesting to view an arbitrary URL. |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 EXPECT_EQ("dark serif", result); | 633 EXPECT_EQ("dark serif", result); |
| 646 EXPECT_EQ(kDarkToolbarThemeColor, contents->GetThemeColor()); | 634 EXPECT_EQ(kDarkToolbarThemeColor, contents->GetThemeColor()); |
| 647 | 635 |
| 648 EXPECT_TRUE(content::ExecuteScriptAndExtractString( | 636 EXPECT_TRUE(content::ExecuteScriptAndExtractString( |
| 649 contents, kGetFontSize, &result)); | 637 contents, kGetFontSize, &result)); |
| 650 base::StringToDouble(result, &fontSize); | 638 base::StringToDouble(result, &fontSize); |
| 651 ASSERT_FLOAT_EQ(kScale, fontSize/oldFontSize); | 639 ASSERT_FLOAT_EQ(kScale, fontSize/oldFontSize); |
| 652 } | 640 } |
| 653 | 641 |
| 654 } // namespace dom_distiller | 642 } // namespace dom_distiller |
| OLD | NEW |