Index: chrome/browser/user_style_sheet_watcher_unittest.cc |
diff --git a/chrome/browser/user_style_sheet_watcher_unittest.cc b/chrome/browser/user_style_sheet_watcher_unittest.cc |
index e3f0d069256c42b89754d7434e003672ac668de6..a9df6fb4f7ecaf058b33ff4e75a985ffeff2d7f7 100644 |
--- a/chrome/browser/user_style_sheet_watcher_unittest.cc |
+++ b/chrome/browser/user_style_sheet_watcher_unittest.cc |
@@ -4,11 +4,13 @@ |
#include "chrome/browser/user_style_sheet_watcher.h" |
+#include "base/basictypes.h" |
#include "base/base64.h" |
#include "base/file_util.h" |
#include "base/message_loop.h" |
#include "base/scoped_temp_dir.h" |
#include "base/string_util.h" |
+#include "base/threading/thread.h" |
#include "content/browser/browser_thread.h" |
#include "testing/gtest/include/gtest/gtest.h" |
@@ -25,20 +27,25 @@ TEST(UserStyleSheetWatcherTest, StyleLoad) { |
scoped_refptr<UserStyleSheetWatcher> style_sheet_watcher( |
new UserStyleSheetWatcher(dir.path())); |
- MessageLoop loop; |
- BrowserThread ui_thread(BrowserThread::UI, &loop); |
- BrowserThread file_thread(BrowserThread::FILE, &loop); |
+ |
+ MessageLoop loop(MessageLoop::TYPE_UI); |
+ base::Thread io_thread("UserStyleSheetWatcherTestIOThread"); |
+ base::Thread::Options options(MessageLoop::TYPE_IO, 0); |
+ io_thread.StartWithOptions(options); |
+ BrowserThread browser_ui_thread(BrowserThread::UI, &loop); |
+ BrowserThread browser_file_thread(BrowserThread::FILE, |
+ io_thread.message_loop()); |
style_sheet_watcher->Init(); |
+ io_thread.Stop(); |
loop.RunAllPending(); |
GURL result_url = style_sheet_watcher->user_style_sheet(); |
std::string result = result_url.spec(); |
std::string prefix = "data:text/css;charset=utf-8;base64,"; |
- EXPECT_TRUE(StartsWithASCII(result, prefix, true)); |
+ ASSERT_TRUE(StartsWithASCII(result, prefix, true)); |
result = result.substr(prefix.length()); |
std::string decoded; |
- EXPECT_TRUE(base::Base64Decode(result, &decoded)); |
- EXPECT_EQ(css_file_contents, decoded); |
- style_sheet_watcher = NULL; |
+ ASSERT_TRUE(base::Base64Decode(result, &decoded)); |
+ ASSERT_EQ(css_file_contents, decoded); |
} |