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

Side by Side Diff: chrome/browser/password_manager/native_backend_gnome_x_unittest.cc

Issue 7465041: GTTF: Use a fresh TestingBrowserProcess for each test, part #4 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdarg.h> 5 #include <stdarg.h>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/time.h" 10 #include "base/time.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "chrome/browser/password_manager/native_backend_gnome_x.h" 12 #include "chrome/browser/password_manager/native_backend_gnome_x.h"
13 #include "chrome/browser/prefs/pref_service.h" 13 #include "chrome/browser/prefs/pref_service.h"
14 #include "chrome/common/pref_names.h" 14 #include "chrome/common/pref_names.h"
15 #include "chrome/test/base/testing_profile.h" 15 #include "chrome/test/base/testing_profile.h"
16 #include "chrome/test/testing_browser_process_test.h"
16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 18
18 using webkit_glue::PasswordForm; 19 using webkit_glue::PasswordForm;
19 20
20 namespace { 21 namespace {
21 22
22 // What follows is a very simple implementation of the subset of the GNOME 23 // What follows is a very simple implementation of the subset of the GNOME
23 // Keyring API that we actually use. It gets substituted for the real one by 24 // Keyring API that we actually use. It gets substituted for the real one by
24 // MockGnomeKeyringLoader, which hooks into the facility normally used to load 25 // MockGnomeKeyringLoader, which hooks into the facility normally used to load
25 // the GNOME Keyring library at runtime to avoid a static dependency on it. 26 // the GNOME Keyring library at runtime to avoid a static dependency on it.
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 } // anonymous namespace 273 } // anonymous namespace
273 274
274 // NativeBackendGnome isn't reference counted, but in these unit tests that 275 // NativeBackendGnome isn't reference counted, but in these unit tests that
275 // won't be a problem as it always outlives the threads we post tasks to. 276 // won't be a problem as it always outlives the threads we post tasks to.
276 template<> 277 template<>
277 struct RunnableMethodTraits<NativeBackendGnome> { 278 struct RunnableMethodTraits<NativeBackendGnome> {
278 void RetainCallee(NativeBackendGnome*) {} 279 void RetainCallee(NativeBackendGnome*) {}
279 void ReleaseCallee(NativeBackendGnome*) {} 280 void ReleaseCallee(NativeBackendGnome*) {}
280 }; 281 };
281 282
282 class NativeBackendGnomeTest : public testing::Test { 283 class NativeBackendGnomeTest : public TestingBrowserProcessTest {
283 protected: 284 protected:
284 NativeBackendGnomeTest() 285 NativeBackendGnomeTest()
285 : ui_thread_(BrowserThread::UI, &message_loop_), 286 : ui_thread_(BrowserThread::UI, &message_loop_),
286 db_thread_(BrowserThread::DB) { 287 db_thread_(BrowserThread::DB) {
287 } 288 }
288 289
289 virtual void SetUp() { 290 virtual void SetUp() {
290 ASSERT_TRUE(db_thread_.Start()); 291 ASSERT_TRUE(db_thread_.Start());
291 292
292 MockGnomeKeyringLoader::LoadMockGnomeKeyring(); 293 MockGnomeKeyringLoader::LoadMockGnomeKeyring();
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 RunBothThreads(); 858 RunBothThreads();
858 859
859 // The other two copies of the password in different profiles should remain. 860 // The other two copies of the password in different profiles should remain.
860 EXPECT_EQ(2u, mock_keyring_items.size()); 861 EXPECT_EQ(2u, mock_keyring_items.size());
861 if (mock_keyring_items.size() > 0) 862 if (mock_keyring_items.size() > 0)
862 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); 863 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome");
863 if (mock_keyring_items.size() > 1) 864 if (mock_keyring_items.size() > 1)
864 CheckMockKeyringItem(&mock_keyring_items[1], form_google_, "chrome-42"); 865 CheckMockKeyringItem(&mock_keyring_items[1], form_google_, "chrome-42");
865 } 866 }
866 } 867 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698