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

Side by Side Diff: chrome/test/ui/ui_layout_test.cc

Issue 3160027: Set state of a new audio stream to paused until it starts playing. (Closed)
Patch Set: - Created 10 years, 4 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
« no previous file with comments | « chrome/renderer/media/audio_renderer_impl.cc ('k') | 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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/test/ui/ui_layout_test.h" 5 #include "chrome/test/ui/ui_layout_test.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/test/test_file_util.h" 10 #include "base/test/test_file_util.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 130
131 // Reads the layout test controller simulation script. 131 // Reads the layout test controller simulation script.
132 FilePath path; 132 FilePath path;
133 PathService::Get(chrome::DIR_TEST_DATA, &path); 133 PathService::Get(chrome::DIR_TEST_DATA, &path);
134 path = path.AppendASCII("layout_tests"); 134 path = path.AppendASCII("layout_tests");
135 path = path.AppendASCII("layout_test_controller.html"); 135 path = path.AppendASCII("layout_test_controller.html");
136 ASSERT_TRUE(file_util::ReadFileToString(path, &layout_test_controller_)); 136 ASSERT_TRUE(file_util::ReadFileToString(path, &layout_test_controller_));
137 } 137 }
138 138
139 void UILayoutTest::AddResourceForLayoutTest(const FilePath& parent_dir, 139 void UILayoutTest::AddResourceForLayoutTest(const FilePath& parent_dir,
140 const FilePath& resource_dir) { 140 const FilePath& resource_name) {
141 FilePath root_dir; 141 FilePath root_dir;
142 PathService::Get(base::DIR_SOURCE_ROOT, &root_dir); 142 PathService::Get(base::DIR_SOURCE_ROOT, &root_dir);
143 143
144 FilePath src_dir = root_dir.AppendASCII("chrome"); 144 FilePath source = root_dir.AppendASCII("chrome");
145 src_dir = src_dir.AppendASCII("test"); 145 source = source.AppendASCII("test");
146 src_dir = src_dir.AppendASCII("data"); 146 source = source.AppendASCII("data");
147 src_dir = src_dir.AppendASCII("layout_tests"); 147 source = source.AppendASCII("layout_tests");
148 src_dir = src_dir.AppendASCII("LayoutTests"); 148 source = source.AppendASCII("LayoutTests");
149 src_dir = src_dir.Append(parent_dir); 149 source = source.Append(parent_dir);
150 src_dir = src_dir.Append(resource_dir); 150 source = source.Append(resource_name);
151 ASSERT_TRUE(file_util::DirectoryExists(src_dir)); 151
152 ASSERT_TRUE(file_util::PathExists(source));
152 153
153 FilePath dest_parent_dir = temp_test_dir_. 154 FilePath dest_parent_dir = temp_test_dir_.
154 AppendASCII("LayoutTests").Append(parent_dir); 155 AppendASCII("LayoutTests").Append(parent_dir);
155 ASSERT_TRUE(file_util::CreateDirectory(dest_parent_dir)); 156 ASSERT_TRUE(file_util::CreateDirectory(dest_parent_dir));
156 FilePath dest_dir = dest_parent_dir.Append(resource_dir); 157 FilePath dest = dest_parent_dir.Append(resource_name);
157 ASSERT_TRUE(file_util::CopyDirectory(src_dir, dest_dir, true)); 158
159 if (file_util::DirectoryExists(source)) {
160 ASSERT_TRUE(file_util::CopyDirectory(source, dest, true));
161 } else {
162 ASSERT_TRUE(file_util::CopyFile(source, dest));
163 }
158 } 164 }
159 165
160 static size_t FindInsertPosition(const std::string& html) { 166 static size_t FindInsertPosition(const std::string& html) {
161 size_t tag_start = html.find("<html"); 167 size_t tag_start = html.find("<html");
162 if (tag_start == std::string::npos) 168 if (tag_start == std::string::npos)
163 return 0; 169 return 0;
164 size_t tag_end = html.find(">", tag_start); 170 size_t tag_end = html.find(">", tag_start);
165 if (tag_end == std::string::npos) 171 if (tag_end == std::string::npos)
166 return 0; 172 return 0;
167 return tag_end + 1; 173 return tag_end + 1;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 std::string* expected_result_value) { 260 std::string* expected_result_value) {
255 FilePath expected_result_path(result_dir_path); 261 FilePath expected_result_path(result_dir_path);
256 expected_result_path = expected_result_path.AppendASCII(test_case_file_name); 262 expected_result_path = expected_result_path.AppendASCII(test_case_file_name);
257 expected_result_path = expected_result_path.InsertBeforeExtension( 263 expected_result_path = expected_result_path.InsertBeforeExtension(
258 FILE_PATH_LITERAL("-expected")); 264 FILE_PATH_LITERAL("-expected"));
259 expected_result_path = 265 expected_result_path =
260 expected_result_path.ReplaceExtension(FILE_PATH_LITERAL("txt")); 266 expected_result_path.ReplaceExtension(FILE_PATH_LITERAL("txt"));
261 return file_util::ReadFileToString(expected_result_path, 267 return file_util::ReadFileToString(expected_result_path,
262 expected_result_value); 268 expected_result_value);
263 } 269 }
OLDNEW
« no previous file with comments | « chrome/renderer/media/audio_renderer_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698