Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: components/dom_distiller/content/distiller_page_web_contents_browsertest.cc

Issue 225813008: Change regex back to wildcard match. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/values.h" 8 #include "base/values.h"
9 #include "components/dom_distiller/content/distiller_page_web_contents.h" 9 #include "components/dom_distiller/content/distiller_page_web_contents.h"
10 #include "components/dom_distiller/core/distiller_page.h" 10 #include "components/dom_distiller/core/distiller_page.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 base::RunLoop run_loop; 114 base::RunLoop run_loop;
115 DistillPage(run_loop.QuitClosure(), "/simple_article.html"); 115 DistillPage(run_loop.QuitClosure(), "/simple_article.html");
116 run_loop.Run(); 116 run_loop.Run();
117 117
118 const base::ListValue* result_list = NULL; 118 const base::ListValue* result_list = NULL;
119 ASSERT_TRUE(value_->GetAsList(&result_list)); 119 ASSERT_TRUE(value_->GetAsList(&result_list));
120 std::string html; 120 std::string html;
121 result_list->GetString(1, &html); 121 result_list->GetString(1, &html);
122 // A relative link should've been updated. 122 // A relative link should've been updated.
123 EXPECT_THAT(html, 123 EXPECT_THAT(html,
124 ContainsRegex("href=\"http://127.0.0.1:[0-9]*/relativelink.html\"" )); 124 ContainsRegex("href=\"http://127.0.0.1:.*/relativelink.html\""));
125 EXPECT_THAT(html, 125 EXPECT_THAT(html,
126 HasSubstr("href=\"http://www.google.com/absolutelink.html\"")); 126 HasSubstr("href=\"http://www.google.com/absolutelink.html\""));
127 } 127 }
128 128
129 IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest, HandlesRelativeImages) { 129 IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest, HandlesRelativeImages) {
130 base::WeakPtrFactory<DistillerPage::Delegate> weak_factory(this); 130 base::WeakPtrFactory<DistillerPage::Delegate> weak_factory(this);
131 DistillerPageWebContents distiller_page( 131 DistillerPageWebContents distiller_page(
132 weak_factory.GetWeakPtr(), shell()->web_contents()->GetBrowserContext()); 132 weak_factory.GetWeakPtr(), shell()->web_contents()->GetBrowserContext());
133 distiller_page_ = &distiller_page; 133 distiller_page_ = &distiller_page;
134 distiller_page.Init(); 134 distiller_page.Init();
135 135
136 base::RunLoop run_loop; 136 base::RunLoop run_loop;
137 DistillPage(run_loop.QuitClosure(), "/simple_article.html"); 137 DistillPage(run_loop.QuitClosure(), "/simple_article.html");
138 run_loop.Run(); 138 run_loop.Run();
139 139
140 const base::ListValue* result_list = NULL; 140 const base::ListValue* result_list = NULL;
141 ASSERT_TRUE(value_->GetAsList(&result_list)); 141 ASSERT_TRUE(value_->GetAsList(&result_list));
142 std::string html; 142 std::string html;
143 result_list->GetString(1, &html); 143 result_list->GetString(1, &html);
144 // A relative link should've been updated. 144 // A relative link should've been updated.
145 EXPECT_THAT(html, 145 EXPECT_THAT(html,
146 ContainsRegex("src=\"http://127.0.0.1:[0-9]*/relativeimage.png\"") ); 146 ContainsRegex("src=\"http://127.0.0.1:.*/relativeimage.png\""));
147 EXPECT_THAT(html, 147 EXPECT_THAT(html,
148 HasSubstr("src=\"http://www.google.com/absoluteimage.png\"")); 148 HasSubstr("src=\"http://www.google.com/absoluteimage.png\""));
149 } 149 }
150 150
151 } // namespace dom_distiller 151 } // namespace dom_distiller
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698