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

Unified Diff: chrome/browser/chrome_thread_unittest.cc

Issue 306032: Simplify threading in browser thread by making only ChromeThread deal with di... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: a few more simplifications Created 11 years, 2 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/chrome_thread_unittest.cc
===================================================================
--- chrome/browser/chrome_thread_unittest.cc (revision 30037)
+++ chrome/browser/chrome_thread_unittest.cc (working copy)
@@ -1,68 +0,0 @@
-// Copyright (c) 2006-2008 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 <vector>
-
-#include "chrome/browser/chrome_thread.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "testing/platform_test.h"
-
-typedef PlatformTest ChromeThreadTest;
-
-TEST_F(ChromeThreadTest, Get) {
darin (slow to review) 2009/10/27 00:06:52 maybe there are still some interesting tests to wr
jam 2009/10/27 02:38:18 I couldn't think of any non-trivial tests. I figu
jam 2009/10/27 02:46:29 On second thoughts, I'll leave the file with an em
darin (slow to review) 2009/10/27 04:43:33 OK... I was thinking that you might be able to tes
- scoped_ptr<ChromeThread> io_thread;
- scoped_ptr<ChromeThread> file_thread;
- scoped_ptr<ChromeThread> db_thread;
-
- EXPECT_TRUE(ChromeThread::GetMessageLoop(ChromeThread::IO) == NULL);
- EXPECT_TRUE(ChromeThread::GetMessageLoop(ChromeThread::FILE) == NULL);
- EXPECT_TRUE(ChromeThread::GetMessageLoop(ChromeThread::DB) == NULL);
-
- // Phase 1: Create threads.
-
- io_thread.reset(new ChromeThread(ChromeThread::IO));
- file_thread.reset(new ChromeThread(ChromeThread::FILE));
- db_thread.reset(new ChromeThread(ChromeThread::DB));
-
- EXPECT_TRUE(ChromeThread::GetMessageLoop(ChromeThread::IO) == NULL);
- EXPECT_TRUE(ChromeThread::GetMessageLoop(ChromeThread::FILE) == NULL);
- EXPECT_TRUE(ChromeThread::GetMessageLoop(ChromeThread::DB) == NULL);
-
- // Phase 2: Start the threads.
-
- io_thread->Start();
- file_thread->Start();
- db_thread->Start();
-
- EXPECT_TRUE(io_thread->message_loop() != NULL);
- EXPECT_TRUE(file_thread->message_loop() != NULL);
- EXPECT_TRUE(db_thread->message_loop() != NULL);
-
- EXPECT_TRUE(ChromeThread::GetMessageLoop(ChromeThread::IO) ==
- io_thread->message_loop());
- EXPECT_TRUE(ChromeThread::GetMessageLoop(ChromeThread::FILE) ==
- file_thread->message_loop());
- EXPECT_TRUE(ChromeThread::GetMessageLoop(ChromeThread::DB) ==
- db_thread->message_loop());
-
- // Phase 3: Stop the threads.
-
- io_thread->Stop();
- file_thread->Stop();
- db_thread->Stop();
-
- EXPECT_TRUE(ChromeThread::GetMessageLoop(ChromeThread::IO) == NULL);
- EXPECT_TRUE(ChromeThread::GetMessageLoop(ChromeThread::FILE) == NULL);
- EXPECT_TRUE(ChromeThread::GetMessageLoop(ChromeThread::DB) == NULL);
-
- // Phase 4: Destroy the threads.
-
- io_thread.reset();
- file_thread.reset();
- db_thread.reset();
-
- EXPECT_TRUE(ChromeThread::GetMessageLoop(ChromeThread::IO) == NULL);
- EXPECT_TRUE(ChromeThread::GetMessageLoop(ChromeThread::FILE) == NULL);
- EXPECT_TRUE(ChromeThread::GetMessageLoop(ChromeThread::DB) == NULL);
-}

Powered by Google App Engine
This is Rietveld 408576698