OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <atlbase.h> | 5 #include <atlbase.h> |
6 #include <atlcom.h> | 6 #include <atlcom.h> |
7 | 7 |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/win/scoped_comptr.h" | 10 #include "base/win/scoped_comptr.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 DeleteAllSingletons(); | 25 DeleteAllSingletons(); |
26 PathService::Get(base::DIR_SOURCE_ROOT, &test_file_path_); | 26 PathService::Get(base::DIR_SOURCE_ROOT, &test_file_path_); |
27 test_file_path_ = test_file_path_.Append(FILE_PATH_LITERAL("chrome_frame")) | 27 test_file_path_ = test_file_path_.Append(FILE_PATH_LITERAL("chrome_frame")) |
28 .Append(FILE_PATH_LITERAL("test")) | 28 .Append(FILE_PATH_LITERAL("test")) |
29 .Append(FILE_PATH_LITERAL("data")); | 29 .Append(FILE_PATH_LITERAL("data")); |
30 } | 30 } |
31 | 31 |
32 bool ReadFileAsString(const wchar_t* file_name, std::string* file_contents) { | 32 bool ReadFileAsString(const wchar_t* file_name, std::string* file_contents) { |
33 EXPECT_TRUE(file_name); | 33 EXPECT_TRUE(file_name); |
34 base::FilePath file_path = test_file_path_.Append(file_name); | 34 base::FilePath file_path = test_file_path_.Append(file_name); |
35 return file_util::ReadFileToString(file_path, file_contents); | 35 return base::ReadFileToString(file_path, file_contents); |
36 } | 36 } |
37 | 37 |
38 static bool StringToStream(const std::string& data, IStream** ret) { | 38 static bool StringToStream(const std::string& data, IStream** ret) { |
39 EXPECT_TRUE(!data.empty()); | 39 EXPECT_TRUE(!data.empty()); |
40 | 40 |
41 base::win::ScopedComPtr<IStream> stream; | 41 base::win::ScopedComPtr<IStream> stream; |
42 HRESULT hr = CreateStreamOnHGlobal(NULL, TRUE, stream.Receive()); | 42 HRESULT hr = CreateStreamOnHGlobal(NULL, TRUE, stream.Receive()); |
43 EXPECT_HRESULT_SUCCEEDED(hr); | 43 EXPECT_HRESULT_SUCCEEDED(hr); |
44 if (FAILED(hr)) { | 44 if (FAILED(hr)) { |
45 return false; | 45 return false; |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 244 |
245 std::string data_read; | 245 std::string data_read; |
246 data_read.append(read_buffer1.get(), read_size1); | 246 data_read.append(read_buffer1.get(), read_size1); |
247 data_read.append(read_buffer2.get(), read_size2); | 247 data_read.append(read_buffer2.get(), read_size2); |
248 EXPECT_EQ(small_html_meta_tag, data_read); | 248 EXPECT_EQ(small_html_meta_tag, data_read); |
249 | 249 |
250 EXPECT_EQ(S_FALSE, ret3); | 250 EXPECT_EQ(S_FALSE, ret3); |
251 EXPECT_STREQ("", read_buffer3); | 251 EXPECT_STREQ("", read_buffer3); |
252 EXPECT_EQ(sizeof(read_buffer3), read_size3); | 252 EXPECT_EQ(sizeof(read_buffer3), read_size3); |
253 } | 253 } |
OLD | NEW |