summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/user_script_master_unittest.cc
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-12 12:56:20 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-12 12:56:20 +0000
commit4003d7147b7de61f66bd76dcfdf0a56de54fb4f7 (patch)
treee28e2c975fb7fc6bc255fb81671c9879913a75c7 /chrome/browser/extensions/user_script_master_unittest.cc
parent5a62814d1d33572b1b3cbfed4eaf3f49a1ae5498 (diff)
downloadchromium_src-4003d7147b7de61f66bd76dcfdf0a56de54fb4f7.zip
chromium_src-4003d7147b7de61f66bd76dcfdf0a56de54fb4f7.tar.gz
chromium_src-4003d7147b7de61f66bd76dcfdf0a56de54fb4f7.tar.bz2
Add more tests to unit_tests on Linux, and some platform cleanups.
Review URL: http://codereview.chromium.org/17277 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7864 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/user_script_master_unittest.cc')
-rw-r--r--chrome/browser/extensions/user_script_master_unittest.cc32
1 files changed, 16 insertions, 16 deletions
diff --git a/chrome/browser/extensions/user_script_master_unittest.cc b/chrome/browser/extensions/user_script_master_unittest.cc
index c630bbd..8e3b95d 100644
--- a/chrome/browser/extensions/user_script_master_unittest.cc
+++ b/chrome/browser/extensions/user_script_master_unittest.cc
@@ -23,14 +23,13 @@ class UserScriptMasterTest : public testing::Test,
virtual void SetUp() {
// Name a subdirectory of the temp directory.
- std::wstring path_str;
- ASSERT_TRUE(PathService::Get(base::DIR_TEMP, &path_str));
- script_dir_ = FilePath(path_str).Append(
- FILE_PATH_LITERAL("UserScriptTest"));
+ FilePath tmp_dir;
+ ASSERT_TRUE(PathService::Get(base::DIR_TEMP, &tmp_dir));
+ script_dir_ = tmp_dir.Append(FILE_PATH_LITERAL("UserScriptTest"));
// Create a fresh, empty copy of this directory.
- file_util::Delete(script_dir_.value(), true);
- file_util::CreateDirectory(script_dir_.value());
+ file_util::Delete(script_dir_, true);
+ file_util::CreateDirectory(script_dir_);
// Register for all user script notifications.
NotificationService::current()->AddObserver(this,
@@ -44,8 +43,8 @@ class UserScriptMasterTest : public testing::Test,
NotificationService::AllSources());
// Clean up test directory.
- ASSERT_TRUE(file_util::Delete(script_dir_.value(), true));
- ASSERT_FALSE(file_util::PathExists(script_dir_.value()));
+ ASSERT_TRUE(file_util::Delete(script_dir_, true));
+ ASSERT_FALSE(file_util::PathExists(script_dir_));
}
virtual void Observe(NotificationType type,
@@ -90,10 +89,10 @@ TEST_F(UserScriptMasterTest, NewScripts) {
FilePath path = script_dir_.Append(FILE_PATH_LITERAL("script.user.js"));
- std::ofstream file;
- file.open(WideToUTF8(path.value()).c_str());
- file << "some content";
- file.close();
+ FILE* file = file_util::OpenFile(path, "w");
+ const char content[] = "some content";
+ fwrite(content, 1, arraysize(content), file);
+ file_util::CloseFile(file);
message_loop_.Run();
@@ -103,10 +102,11 @@ TEST_F(UserScriptMasterTest, NewScripts) {
// Test that we get notified about scripts if they're already in the test dir.
TEST_F(UserScriptMasterTest, ExistingScripts) {
FilePath path = script_dir_.Append(FILE_PATH_LITERAL("script.user.js"));
- std::ofstream file;
- file.open(WideToUTF8(path.value()).c_str());
- file << "some content";
- file.close();
+
+ FILE* file = file_util::OpenFile(path, "w");
+ const char content[] = "some content";
+ fwrite(content, 1, arraysize(content), file);
+ file_util::CloseFile(file);
scoped_refptr<UserScriptMaster> master(
new UserScriptMaster(MessageLoop::current(), script_dir_));