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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/guid.h" | 8 #include "base/guid.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 GURL view_url("http://www.example.com/1"); | 335 GURL view_url("http://www.example.com/1"); |
336 content::WebContents* contents = | 336 content::WebContents* contents = |
337 browser()->tab_strip_model()->GetActiveWebContents(); | 337 browser()->tab_strip_model()->GetActiveWebContents(); |
338 const GURL url = | 338 const GURL url = |
339 url_utils::GetDistillerViewUrlFromUrl(kDomDistillerScheme, view_url); | 339 url_utils::GetDistillerViewUrlFromUrl(kDomDistillerScheme, view_url); |
340 ViewSingleDistilledPage(url, "text/html"); | 340 ViewSingleDistilledPage(url, "text/html"); |
341 content::WaitForLoadStop(contents); | 341 content::WaitForLoadStop(contents); |
342 std::string result; | 342 std::string result; |
343 EXPECT_TRUE(content::ExecuteScriptAndExtractString( | 343 EXPECT_TRUE(content::ExecuteScriptAndExtractString( |
344 contents, kGetBodyClass, &result)); | 344 contents, kGetBodyClass, &result)); |
345 EXPECT_EQ("light", result); | 345 EXPECT_EQ("light sans-serif", result); |
346 | 346 |
347 // Getting DistilledPagePrefs instance. | |
348 DistilledPagePrefs* distilled_page_prefs = | 347 DistilledPagePrefs* distilled_page_prefs = |
349 DomDistillerServiceFactory::GetForBrowserContext( | 348 DomDistillerServiceFactory::GetForBrowserContext( |
350 browser()->profile())->GetDistilledPagePrefs(); | 349 browser()->profile())->GetDistilledPagePrefs(); |
351 | 350 |
352 distilled_page_prefs->SetTheme(DistilledPagePrefs::DARK); | 351 distilled_page_prefs->SetTheme(DistilledPagePrefs::DARK); |
353 base::RunLoop().RunUntilIdle(); | 352 base::RunLoop().RunUntilIdle(); |
354 EXPECT_TRUE(content::ExecuteScriptAndExtractString( | 353 EXPECT_TRUE(content::ExecuteScriptAndExtractString( |
355 contents, kGetBodyClass, &result)); | 354 contents, kGetBodyClass, &result)); |
356 EXPECT_EQ("dark", result); | 355 EXPECT_EQ("dark sans-serif", result); |
| 356 |
| 357 distilled_page_prefs->SetFontFamily(DistilledPagePrefs::SERIF); |
| 358 base::RunLoop().RunUntilIdle(); |
| 359 EXPECT_TRUE( |
| 360 content::ExecuteScriptAndExtractString(contents, kGetBodyClass, &result)); |
| 361 EXPECT_EQ("dark serif", result); |
357 } | 362 } |
358 | 363 |
359 } // namespace dom_distiller | 364 } // namespace dom_distiller |
OLD | NEW |