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

Unified Diff: chrome/browser/user_style_sheet_watcher_unittest.cc

Issue 6670081: Move FilePathWatcher class from browser/... to common/... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 9 years, 9 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 side-by-side diff with in-line comments
Download patch
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);
}

Powered by Google App Engine
This is Rietveld 408576698