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

Unified Diff: chrome/browser/user_style_sheet_watcher_unittest.cc

Issue 64843004: Get rid of user-level styles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge to ToT Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/user_style_sheet_watcher_factory.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
deleted file mode 100644
index 48f5ebb4858a712cc701980b5b9bc1dd5afc4e81..0000000000000000000000000000000000000000
--- a/chrome/browser/user_style_sheet_watcher_unittest.cc
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/user_style_sheet_watcher.h"
-
-#include "base/base64.h"
-#include "base/basictypes.h"
-#include "base/file_util.h"
-#include "base/files/scoped_temp_dir.h"
-#include "base/message_loop/message_loop.h"
-#include "base/strings/string_util.h"
-#include "base/threading/thread.h"
-#include "chrome/test/base/testing_browser_process.h"
-#include "content/public/test/test_browser_thread.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-using content::BrowserThread;
-
-TEST(UserStyleSheetWatcherTest, StyleLoad) {
- base::ScopedTempDir dir;
- ASSERT_TRUE(dir.CreateUniqueTempDir());
-
- std::string css_file_contents = "a { color: green; }";
- base::FilePath style_sheet_file = dir.path().AppendASCII("User StyleSheets")
- .AppendASCII("Custom.css");
- file_util::CreateDirectory(style_sheet_file.DirName());
- ASSERT_TRUE(file_util::WriteFile(style_sheet_file,
- css_file_contents.data(), css_file_contents.length()));
-
- base::MessageLoop loop(base::MessageLoop::TYPE_UI);
- base::Thread io_thread("UserStyleSheetWatcherTestIOThread");
- base::Thread::Options options(base::MessageLoop::TYPE_IO, 0);
- ASSERT_TRUE(io_thread.StartWithOptions(options));
- content::TestBrowserThread browser_ui_thread(BrowserThread::UI, &loop);
- content::TestBrowserThread browser_file_thread(BrowserThread::FILE,
- io_thread.message_loop());
-
- // It is important that the creation of |style_sheet_watcher| occur after the
- // creation of |browser_ui_thread| because UserStyleSheetWatchers are
- // restricted to being deleted only on UI browser threads.
- scoped_refptr<UserStyleSheetWatcher> style_sheet_watcher(
- new UserStyleSheetWatcher(NULL, dir.path()));
- style_sheet_watcher->Init();
-
- io_thread.Stop();
- loop.RunUntilIdle();
-
- 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,";
- ASSERT_TRUE(StartsWithASCII(result, prefix, true));
- result = result.substr(prefix.length());
- std::string decoded;
- ASSERT_TRUE(base::Base64Decode(result, &decoded));
- ASSERT_EQ(css_file_contents, decoded);
-}
« no previous file with comments | « chrome/browser/user_style_sheet_watcher_factory.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698