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

Side by Side Diff: chrome_frame/test/urlmon_moniker_unittest.cc

Issue 12211108: Rename FilePath -> base::FilePath in various toplevel directories (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | « chrome_frame/test/ui_test.cc ('k') | chrome_frame/test/util_unittests.cc » ('j') | 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) 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 13 matching lines...) Expand all
24 virtual void SetUp() { 24 virtual void SetUp() {
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 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 file_util::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;
46 } 46 }
47 47
48 DWORD written = 0; 48 DWORD written = 0;
49 hr = stream->Write(data.c_str(), data.size(), &written); 49 hr = stream->Write(data.c_str(), data.size(), &written);
50 EXPECT_HRESULT_SUCCEEDED(hr); 50 EXPECT_HRESULT_SUCCEEDED(hr);
51 EXPECT_EQ(data.size(), written); 51 EXPECT_EQ(data.size(), written);
52 52
53 bool result = false; 53 bool result = false;
54 if (SUCCEEDED(hr)) { 54 if (SUCCEEDED(hr)) {
55 RewindStream(stream); 55 RewindStream(stream);
56 *ret = stream.Detach(); 56 *ret = stream.Detach();
57 result = true; 57 result = true;
58 } 58 }
59 59
60 return result; 60 return result;
61 } 61 }
62 62
63 FilePath test_file_path_; 63 base::FilePath test_file_path_;
64 ScopedVirtualizeHklmAndHkcu virtualized_registry_; 64 ScopedVirtualizeHklmAndHkcu virtualized_registry_;
65 }; 65 };
66 66
67 // Tests the CacheStream class by writing content into a stream object 67 // Tests the CacheStream class by writing content into a stream object
68 // and verify that reading that stream back 68 // and verify that reading that stream back
69 TEST_F(MonikerPatchTest, CacheStream) { 69 TEST_F(MonikerPatchTest, CacheStream) {
70 const char data[] = "ReadStreamCacheTest"; 70 const char data[] = "ReadStreamCacheTest";
71 char ret[2 * sizeof(data)] = {0}; 71 char ret[2 * sizeof(data)] = {0};
72 DWORD read = 0; 72 DWORD read = 0;
73 73
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « chrome_frame/test/ui_test.cc ('k') | chrome_frame/test/util_unittests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698