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

Side by Side Diff: net/disk_cache/mapped_file_unittest.cc

Issue 8156: Switch MessagePumpForIO to use completion ports on Windows.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month 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 | « net/disk_cache/file_win.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/string_util.h" 6 #include "base/string_util.h"
7 #include "net/disk_cache/disk_cache_test_base.h" 7 #include "net/disk_cache/disk_cache_test_base.h"
8 #include "net/disk_cache/disk_cache_test_util.h" 8 #include "net/disk_cache/disk_cache_test_util.h"
9 #include "net/disk_cache/mapped_file.h" 9 #include "net/disk_cache/mapped_file.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 file_util::AppendToPath(&filename, L"a_test"); 88 file_util::AppendToPath(&filename, L"a_test");
89 scoped_refptr<disk_cache::MappedFile> file(new disk_cache::MappedFile); 89 scoped_refptr<disk_cache::MappedFile> file(new disk_cache::MappedFile);
90 ASSERT_TRUE(CreateCacheTestFile(filename.c_str())); 90 ASSERT_TRUE(CreateCacheTestFile(filename.c_str()));
91 ASSERT_TRUE(file->Init(filename, 8192)); 91 ASSERT_TRUE(file->Init(filename, 8192));
92 92
93 FileCallbackTest callback(1); 93 FileCallbackTest callback(1);
94 g_cache_tests_error = false; 94 g_cache_tests_error = false;
95 g_cache_tests_max_id = 0; 95 g_cache_tests_max_id = 0;
96 g_cache_tests_received = 0; 96 g_cache_tests_received = 0;
97 97
98 MessageLoopHelper helper;
99
98 char buffer1[20]; 100 char buffer1[20];
99 char buffer2[20]; 101 char buffer2[20];
100 CacheTestFillBuffer(buffer1, sizeof(buffer1), false); 102 CacheTestFillBuffer(buffer1, sizeof(buffer1), false);
101 base::strlcpy(buffer1, "the data", sizeof(buffer1)); 103 base::strlcpy(buffer1, "the data", sizeof(buffer1));
102 bool completed; 104 bool completed;
103 EXPECT_TRUE(file->Write(buffer1, sizeof(buffer1), 1024 * 1024, &callback, 105 EXPECT_TRUE(file->Write(buffer1, sizeof(buffer1), 1024 * 1024, &callback,
104 &completed)); 106 &completed));
105 int expected = completed ? 0 : 1; 107 int expected = completed ? 0 : 1;
106 108
107 g_cache_tests_max_id = 1; 109 g_cache_tests_max_id = 1;
108 WaitForCallbacks(expected); 110 helper.WaitUntilCacheIoFinished(expected);
109 111
110 EXPECT_TRUE(file->Read(buffer2, sizeof(buffer2), 1024 * 1024, &callback, 112 EXPECT_TRUE(file->Read(buffer2, sizeof(buffer2), 1024 * 1024, &callback,
111 &completed)); 113 &completed));
112 if (!completed) 114 if (!completed)
113 expected++; 115 expected++;
114 116
115 WaitForCallbacks(expected); 117 helper.WaitUntilCacheIoFinished(expected);
116 118
117 EXPECT_EQ(expected, g_cache_tests_received); 119 EXPECT_EQ(expected, g_cache_tests_received);
118 EXPECT_FALSE(g_cache_tests_error); 120 EXPECT_FALSE(g_cache_tests_error);
119 EXPECT_STREQ(buffer1, buffer2); 121 EXPECT_STREQ(buffer1, buffer2);
120 } 122 }
121 123
OLDNEW
« no previous file with comments | « net/disk_cache/file_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698