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

Side by Side Diff: chrome/browser/search_engines/template_url_parser_unittest.cc

Issue 18286004: Move PathExists to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/file_util.h" 5 #include "base/file_util.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/search_engines/template_url.h" 9 #include "chrome/browser/search_engines/template_url.h"
10 #include "chrome/browser/search_engines/template_url_parser.h" 10 #include "chrome/browser/search_engines/template_url_parser.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 TemplateURLParserTest::TemplateURLParserTest() { 71 TemplateURLParserTest::TemplateURLParserTest() {
72 } 72 }
73 73
74 TemplateURLParserTest::~TemplateURLParserTest() { 74 TemplateURLParserTest::~TemplateURLParserTest() {
75 } 75 }
76 76
77 void TemplateURLParserTest::SetUp() { 77 void TemplateURLParserTest::SetUp() {
78 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &full_path_)); 78 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &full_path_));
79 full_path_ = full_path_.AppendASCII("osdd"); 79 full_path_ = full_path_.AppendASCII("osdd");
80 if (!file_util::PathExists(full_path_)) { 80 if (!base::PathExists(full_path_)) {
81 LOG(ERROR) << 81 LOG(ERROR) <<
82 "This test can't be run without some non-redistributable data"; 82 "This test can't be run without some non-redistributable data";
83 full_path_ = base::FilePath(); 83 full_path_ = base::FilePath();
84 } 84 }
85 } 85 }
86 86
87 bool TemplateURLParserTest::is_disabled() const { 87 bool TemplateURLParserTest::is_disabled() const {
88 return full_path_.empty(); 88 return full_path_.empty();
89 } 89 }
90 90
91 void TemplateURLParserTest::ParseFile( 91 void TemplateURLParserTest::ParseFile(
92 const std::string& file_name, 92 const std::string& file_name,
93 TemplateURLParser::ParameterFilter* filter) { 93 TemplateURLParser::ParameterFilter* filter) {
94 base::FilePath full_path; 94 base::FilePath full_path;
95 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &full_path)); 95 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &full_path));
96 full_path = full_path.AppendASCII("osdd"); 96 full_path = full_path.AppendASCII("osdd");
97 full_path = full_path.AppendASCII(file_name); 97 full_path = full_path.AppendASCII(file_name);
98 ASSERT_TRUE(file_util::PathExists(full_path)); 98 ASSERT_TRUE(base::PathExists(full_path));
99 99
100 std::string contents; 100 std::string contents;
101 ASSERT_TRUE(file_util::ReadFileToString(full_path, &contents)); 101 ASSERT_TRUE(file_util::ReadFileToString(full_path, &contents));
102 template_url_.reset(TemplateURLParser::Parse(NULL, false, contents.data(), 102 template_url_.reset(TemplateURLParser::Parse(NULL, false, contents.data(),
103 contents.length(), filter)); 103 contents.length(), filter));
104 } 104 }
105 105
106 106
107 // Actual tests --------------------------------------------------------------- 107 // Actual tests ---------------------------------------------------------------
108 108
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 EXPECT_EQ(ASCIIToUTF16("Yahoo"), template_url_->short_name()); 250 EXPECT_EQ(ASCIIToUTF16("Yahoo"), template_url_->short_name());
251 EXPECT_TRUE(template_url_->url_ref().SupportsReplacement()); 251 EXPECT_TRUE(template_url_->url_ref().SupportsReplacement());
252 EXPECT_TRUE(template_url_->suggestions_url().empty()); 252 EXPECT_TRUE(template_url_->suggestions_url().empty());
253 EXPECT_EQ("http://search.yahoo.com/search?p={searchTerms}&ei=UTF-8", 253 EXPECT_EQ("http://search.yahoo.com/search?p={searchTerms}&ei=UTF-8",
254 template_url_->url()); 254 template_url_->url());
255 ASSERT_EQ(1U, template_url_->input_encodings().size()); 255 ASSERT_EQ(1U, template_url_->input_encodings().size());
256 EXPECT_EQ("UTF-8", template_url_->input_encodings()[0]); 256 EXPECT_EQ("UTF-8", template_url_->input_encodings()[0]);
257 EXPECT_EQ(GURL("http://search.yahoo.com/favicon.ico"), 257 EXPECT_EQ(GURL("http://search.yahoo.com/favicon.ico"),
258 template_url_->favicon_url()); 258 template_url_->favicon_url());
259 } 259 }
OLDNEW
« no previous file with comments | « chrome/browser/search_engines/template_url_fetcher_unittest.cc ('k') | chrome/browser/sessions/session_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698