diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-24 14:28:46 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-24 14:28:46 +0000 |
commit | 0f43a8f1c138bd8d850a606ff028df8f6c30ba31 (patch) | |
tree | 5c82ffb86cbf1e3356d0b39e8cebbb410b5fe63d | |
parent | d0ef30f4636680ba1ca213d72bb13540fb5ce7f2 (diff) | |
download | chromium_src-0f43a8f1c138bd8d850a606ff028df8f6c30ba31.zip chromium_src-0f43a8f1c138bd8d850a606ff028df8f6c30ba31.tar.gz chromium_src-0f43a8f1c138bd8d850a606ff028df8f6c30ba31.tar.bz2 |
Porting of unit tests in chrome/
- enable following tests on Linux:
browser/net/resolve_proxy_msg_helper_unittest.cc
browser/profile_manager_unittest.cc
browser/sessions/tab_restore_service_unittest.cc
common/time_format_unittest.cc
- sync chrome.gyp
- fix a bug in resolve_proxy_msg_helper_unittest that triggered
a DCHECK on POSIX.
It freed the WaitableEvent too early because Wait in dtor
was effectively a noop because the event was already in signaled
state from previous operations and a manual-reset flag was set.
The fix was to put the WaitableEvent in automatic reset mode.
- misc GCC-related cleanups
http://crbug.com/9227
Review URL: http://codereview.chromium.org/53007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12356 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/net/resolve_proxy_msg_helper_unittest.cc | 2 | ||||
-rw-r--r-- | chrome/browser/sessions/tab_restore_service_unittest.cc | 56 | ||||
-rw-r--r-- | chrome/chrome.gyp | 2 | ||||
-rw-r--r-- | chrome/test/unit/unit_tests.scons | 5 |
4 files changed, 29 insertions, 36 deletions
diff --git a/chrome/browser/net/resolve_proxy_msg_helper_unittest.cc b/chrome/browser/net/resolve_proxy_msg_helper_unittest.cc index efc53b7c..d33a03b 100644 --- a/chrome/browser/net/resolve_proxy_msg_helper_unittest.cc +++ b/chrome/browser/net/resolve_proxy_msg_helper_unittest.cc @@ -134,7 +134,7 @@ class AsyncRequestRunner : public ResolveProxyMsgHelper::Delegate { // io thread. class RunnerBridge { public: - RunnerBridge() : io_thread_("io_thread"), done_(true, false) { + RunnerBridge() : io_thread_("io_thread"), done_(false, false) { // Start an io thread where we will run the async requests. base::Thread::Options options; options.message_loop_type = MessageLoop::TYPE_IO; diff --git a/chrome/browser/sessions/tab_restore_service_unittest.cc b/chrome/browser/sessions/tab_restore_service_unittest.cc index 4537c8b..9b8b2dd 100644 --- a/chrome/browser/sessions/tab_restore_service_unittest.cc +++ b/chrome/browser/sessions/tab_restore_service_unittest.cc @@ -98,13 +98,13 @@ TEST_F(TabRestoreServiceTest, Basic) { service_->CreateHistoricalTab(controller_); // Make sure an entry was created. - ASSERT_EQ(1, service_->entries().size()); + ASSERT_EQ(1U, service_->entries().size()); // Make sure the entry matches. TabRestoreService::Entry* entry = service_->entries().front(); ASSERT_EQ(TabRestoreService::TAB, entry->type); TabRestoreService::Tab* tab = static_cast<TabRestoreService::Tab*>(entry); - ASSERT_EQ(3, tab->navigations.size()); + ASSERT_EQ(3U, tab->navigations.size()); EXPECT_TRUE(url1_ == tab->navigations[0].url()); EXPECT_TRUE(url2_ == tab->navigations[1].url()); EXPECT_TRUE(url3_ == tab->navigations[2].url()); @@ -116,13 +116,13 @@ TEST_F(TabRestoreServiceTest, Basic) { service_->CreateHistoricalTab(controller_); // There should be two entries now. - ASSERT_EQ(2, service_->entries().size()); + ASSERT_EQ(2U, service_->entries().size()); // Make sure the entry matches entry = service_->entries().front(); ASSERT_EQ(TabRestoreService::TAB, entry->type); tab = static_cast<TabRestoreService::Tab*>(entry); - ASSERT_EQ(3, tab->navigations.size()); + ASSERT_EQ(3U, tab->navigations.size()); EXPECT_TRUE(url1_ == tab->navigations[0].url()); EXPECT_TRUE(url2_ == tab->navigations[1].url()); EXPECT_TRUE(url3_ == tab->navigations[2].url()); @@ -147,13 +147,13 @@ TEST_F(TabRestoreServiceTest, Restore) { RecreateService(); // One entry should be created. - ASSERT_EQ(1, service_->entries().size()); + ASSERT_EQ(1U, service_->entries().size()); // And verify the entry. TabRestoreService::Entry* entry = service_->entries().front(); ASSERT_EQ(TabRestoreService::TAB, entry->type); TabRestoreService::Tab* tab = static_cast<TabRestoreService::Tab*>(entry); - ASSERT_EQ(3, tab->navigations.size()); + ASSERT_EQ(3U, tab->navigations.size()); EXPECT_TRUE(url1_ == tab->navigations[0].url()); EXPECT_TRUE(url2_ == tab->navigations[1].url()); EXPECT_TRUE(url3_ == tab->navigations[2].url()); @@ -166,7 +166,7 @@ TEST_F(TabRestoreServiceTest, DontLoadRestoredTab) { // Have the service record the tab. service_->CreateHistoricalTab(controller_); - ASSERT_EQ(1, service_->entries().size()); + ASSERT_EQ(1U, service_->entries().size()); // Restore the tab. service_->RestoreEntryById(NULL, service_->entries().front()->id, true); @@ -176,7 +176,7 @@ TEST_F(TabRestoreServiceTest, DontLoadRestoredTab) { RecreateService(); // There should be no entries. - ASSERT_EQ(0, service_->entries().size()); + ASSERT_EQ(0U, service_->entries().size()); } // Make sure we don't persist entries to disk that have post data. @@ -186,20 +186,20 @@ TEST_F(TabRestoreServiceTest, DontPersistPostData1) { // Have the service record the tab. service_->CreateHistoricalTab(controller_); - ASSERT_EQ(1, service_->entries().size()); + ASSERT_EQ(1U, service_->entries().size()); // Recreate the service and have it load the tabs. RecreateService(); // One entry should be created. - ASSERT_EQ(1, service_->entries().size()); + ASSERT_EQ(1U, service_->entries().size()); // And verify the entry, the last navigation (url3_) should not have // been written to disk as it contained post data. TabRestoreService::Entry* entry = service_->entries().front(); ASSERT_EQ(TabRestoreService::TAB, entry->type); TabRestoreService::Tab* tab = static_cast<TabRestoreService::Tab*>(entry); - ASSERT_EQ(2, tab->navigations.size()); + ASSERT_EQ(2U, tab->navigations.size()); EXPECT_TRUE(url1_ == tab->navigations[0].url()); EXPECT_TRUE(url2_ == tab->navigations[1].url()); EXPECT_EQ(1, tab->current_navigation_index); @@ -216,20 +216,20 @@ TEST_F(TabRestoreServiceTest, DontPersistPostData2) { // Have the service record the tab. service_->CreateHistoricalTab(controller_); - ASSERT_EQ(1, service_->entries().size()); + ASSERT_EQ(1U, service_->entries().size()); // Recreate the service and have it load the tabs. RecreateService(); // One entry should be created. - ASSERT_EQ(1, service_->entries().size()); + ASSERT_EQ(1U, service_->entries().size()); // And verify the entry, the last navigation (url3_) should not have // been written to disk as it contained post data. TabRestoreService::Entry* entry = service_->entries().front(); ASSERT_EQ(TabRestoreService::TAB, entry->type); TabRestoreService::Tab* tab = static_cast<TabRestoreService::Tab*>(entry); - ASSERT_EQ(1, tab->navigations.size()); + ASSERT_EQ(1U, tab->navigations.size()); EXPECT_TRUE(url3_ == tab->navigations[0].url()); EXPECT_EQ(0, tab->current_navigation_index); } @@ -245,7 +245,7 @@ TEST_F(TabRestoreServiceTest, DontPersistPostData3) { // Have the service record the tab. service_->CreateHistoricalTab(controller_); - ASSERT_EQ(1, service_->entries().size()); + ASSERT_EQ(1U, service_->entries().size()); // Recreate the service and have it load the tabs. RecreateService(); @@ -262,7 +262,7 @@ TEST_F(TabRestoreServiceTest, DontLoadTwice) { // Have the service record the tab. service_->CreateHistoricalTab(controller_); - ASSERT_EQ(1, service_->entries().size()); + ASSERT_EQ(1U, service_->entries().size()); // Recreate the service and have it load the tabs. RecreateService(); @@ -270,7 +270,7 @@ TEST_F(TabRestoreServiceTest, DontLoadTwice) { service_->LoadTabsFromLastSession(); // There should only be one entry. - ASSERT_EQ(1, service_->entries().size()); + ASSERT_EQ(1U, service_->entries().size()); } // Makes sure we load the previous session as necessary. @@ -282,14 +282,14 @@ TEST_F(TabRestoreServiceTest, LoadPreviousSession) { service_->LoadTabsFromLastSession(); // Make sure we get back one entry with one tab whose url is url1. - ASSERT_EQ(1, service_->entries().size()); + ASSERT_EQ(1U, service_->entries().size()); TabRestoreService::Entry* entry2 = service_->entries().front(); ASSERT_EQ(TabRestoreService::WINDOW, entry2->type); TabRestoreService::Window* window = static_cast<TabRestoreService::Window*>(entry2); - ASSERT_EQ(1, window->tabs.size()); + ASSERT_EQ(1U, window->tabs.size()); EXPECT_EQ(0, window->selected_tab_index); - ASSERT_EQ(1, window->tabs[0].navigations.size()); + ASSERT_EQ(1U, window->tabs[0].navigations.size()); EXPECT_EQ(0, window->tabs[0].current_navigation_index); EXPECT_TRUE(url1_ == window->tabs[0].navigations[0].url()); } @@ -305,7 +305,7 @@ TEST_F(TabRestoreServiceTest, DontLoadAfterRestore) { service_->LoadTabsFromLastSession(); // Because we restored a session TabRestoreService shouldn't load the tabs. - ASSERT_EQ(0, service_->entries().size()); + ASSERT_EQ(0U, service_->entries().size()); } // Makes sure we don't attempt to load previous sessions after a clean exit. @@ -318,7 +318,7 @@ TEST_F(TabRestoreServiceTest, DontLoadAfterCleanExit) { service_->LoadTabsFromLastSession(); - ASSERT_EQ(0, service_->entries().size()); + ASSERT_EQ(0U, service_->entries().size()); } TEST_F(TabRestoreServiceTest, LoadPreviousSessionAndTabs) { @@ -334,15 +334,15 @@ TEST_F(TabRestoreServiceTest, LoadPreviousSessionAndTabs) { // We should get back two entries, one from the previous session and one from // the tab restore service. The previous session entry should be first. - ASSERT_EQ(2, service_->entries().size()); + ASSERT_EQ(2U, service_->entries().size()); // The first entry should come from the session service. TabRestoreService::Entry* entry = service_->entries().front(); ASSERT_EQ(TabRestoreService::WINDOW, entry->type); TabRestoreService::Window* window = static_cast<TabRestoreService::Window*>(entry); - ASSERT_EQ(1, window->tabs.size()); + ASSERT_EQ(1U, window->tabs.size()); EXPECT_EQ(0, window->selected_tab_index); - ASSERT_EQ(1, window->tabs[0].navigations.size()); + ASSERT_EQ(1U, window->tabs[0].navigations.size()); EXPECT_EQ(0, window->tabs[0].current_navigation_index); EXPECT_TRUE(url1_ == window->tabs[0].navigations[0].url()); @@ -350,7 +350,7 @@ TEST_F(TabRestoreServiceTest, LoadPreviousSessionAndTabs) { entry = *(++service_->entries().begin()); ASSERT_EQ(TabRestoreService::TAB, entry->type); TabRestoreService::Tab* tab = static_cast<TabRestoreService::Tab*>(entry); - ASSERT_EQ(3, tab->navigations.size()); + ASSERT_EQ(3U, tab->navigations.size()); EXPECT_EQ(2, tab->current_navigation_index); EXPECT_TRUE(url1_ == tab->navigations[0].url()); EXPECT_TRUE(url2_ == tab->navigations[1].url()); @@ -382,9 +382,9 @@ TEST_F(TabRestoreServiceTest, ManyWindowsInSessionService) { ASSERT_EQ(TabRestoreService::WINDOW, entry->type); TabRestoreService::Window* window = static_cast<TabRestoreService::Window*>(entry); - ASSERT_EQ(1, window->tabs.size()); + ASSERT_EQ(1U, window->tabs.size()); EXPECT_EQ(0, window->selected_tab_index); - ASSERT_EQ(1, window->tabs[0].navigations.size()); + ASSERT_EQ(1U, window->tabs[0].navigations.size()); EXPECT_EQ(0, window->tabs[0].current_navigation_index); EXPECT_TRUE(url1_ == window->tabs[0].navigations[0].url()); } diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index d62f58e..7d564c7 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -2184,7 +2184,6 @@ 'browser/importer/importer_unittest.cc', 'browser/login_prompt_unittest.cc', 'browser/navigation_controller_unittest.cc', - 'browser/net/resolve_proxy_msg_helper_unittest.cc', 'browser/password_manager/encryptor_unittest.cc', 'browser/password_manager/password_form_manager_unittest.cc', 'browser/printing/page_number_unittest.cc', @@ -2195,7 +2194,6 @@ 'browser/sessions/session_service_test_helper.cc', 'browser/sessions/session_service_test_helper.h', 'browser/sessions/session_service_unittest.cc', - 'browser/sessions/tab_restore_service_unittest.cc', 'browser/tabs/tab_strip_model_unittest.cc', 'browser/views/bookmark_editor_view_unittest.cc', 'browser/views/find_bar_win_unittest.cc', diff --git a/chrome/test/unit/unit_tests.scons b/chrome/test/unit/unit_tests.scons index 1db16d9..edc4ed7c 100644 --- a/chrome/test/unit/unit_tests.scons +++ b/chrome/test/unit/unit_tests.scons @@ -386,7 +386,6 @@ if not env.Bit('windows'): '$CHROME_DIR/browser/bookmarks/bookmark_drag_data_unittest.cc', '$CHROME_DIR/browser/bookmarks/bookmark_folder_tree_model_unittest.cc', '$CHROME_DIR/browser/bookmarks/bookmark_table_model_unittest.cc', - '$CHROME_DIR/browser/bookmarks/bookmark_utils_unittest.cc', '$CHROME_DIR/browser/browser_commands_unittest.cc', # This test is mostly about renaming downloads to safe file names. As such # we don't need/want to port it to linux. We might want to write our own @@ -396,17 +395,14 @@ if not env.Bit('windows'): '$CHROME_DIR/browser/importer/firefox_importer_unittest.cc', '$CHROME_DIR/browser/importer/importer_unittest.cc', '$CHROME_DIR/browser/login_prompt_unittest.cc', - '$CHROME_DIR/browser/net/resolve_proxy_msg_helper_unittest.cc', '$CHROME_DIR/browser/password_manager/encryptor_unittest.cc', '$CHROME_DIR/browser/password_manager/password_form_manager_unittest.cc', '$CHROME_DIR/browser/printing/page_number_unittest.cc', '$CHROME_DIR/browser/printing/page_overlays_unittest.cc', '$CHROME_DIR/browser/printing/print_job_unittest.cc', '$CHROME_DIR/browser/printing/win_printing_context_unittest.cc', - '$CHROME_DIR/browser/profile_manager_unittest.cc', '$CHROME_DIR/browser/rlz/rlz_unittest.cc', '$CHROME_DIR/browser/sessions/session_service_unittest.cc', - '$CHROME_DIR/browser/sessions/tab_restore_service_unittest.cc', '$CHROME_DIR/browser/tabs/tab_strip_model_unittest.cc', '$CHROME_DIR/browser/views/bookmark_editor_view_unittest.cc', '$CHROME_DIR/browser/views/keyword_editor_view_unittest.cc', @@ -416,7 +412,6 @@ if not env.Bit('windows'): '$CHROME_DIR/common/gfx/emf_unittest.cc', '$CHROME_DIR/common/gfx/icon_util_unittest.cc', '$CHROME_DIR/common/os_exchange_data_unittest.cc', - '$CHROME_DIR/common/time_format_unittest.cc', '$CHROME_DIR/common/win_util_unittest.cc', '$CHROME_DIR/test/browser_with_test_window_test.cc', |