| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/test/live_sync/live_bookmarks_sync_test.h" | 5 #include "chrome/test/live_sync/live_bookmarks_sync_test.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "chrome/browser/bookmarks/bookmark_model.h" | 12 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 13 #include "chrome/browser/profile.h" | 13 #include "chrome/browser/profile.h" |
| 14 #include "chrome/browser/profile_manager.h" | 14 #include "chrome/browser/profile_manager.h" |
| 15 #include "chrome/test/ui_test_utils.h" | 15 #include "chrome/test/ui_test_utils.h" |
| 16 #include "net/base/mock_host_resolver.h" |
| 16 | 17 |
| 17 namespace switches { | 18 namespace switches { |
| 18 const wchar_t kSyncUserForTest[] = L"sync-user-for-test"; | 19 const wchar_t kSyncUserForTest[] = L"sync-user-for-test"; |
| 19 const wchar_t kSyncPasswordForTest[] = L"sync-password-for-test"; | 20 const wchar_t kSyncPasswordForTest[] = L"sync-password-for-test"; |
| 20 } | 21 } |
| 21 | 22 |
| 22 // BookmarkLoadObserver is used when blocking until the BookmarkModel | 23 // BookmarkLoadObserver is used when blocking until the BookmarkModel |
| 23 // finishes loading. As soon as the BookmarkModel finishes loading the message | 24 // finishes loading. As soon as the BookmarkModel finishes loading the message |
| 24 // loop is quit. | 25 // loop is quit. |
| 25 class BookmarkLoadObserver : public BookmarkModelObserver { | 26 class BookmarkLoadObserver : public BookmarkModelObserver { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 45 const BookmarkNode* node) {} | 46 const BookmarkNode* node) {} |
| 46 virtual void BookmarkNodeChildrenReordered(BookmarkModel* model, | 47 virtual void BookmarkNodeChildrenReordered(BookmarkModel* model, |
| 47 const BookmarkNode* node) {} | 48 const BookmarkNode* node) {} |
| 48 virtual void BookmarkNodeFavIconLoaded(BookmarkModel* model, | 49 virtual void BookmarkNodeFavIconLoaded(BookmarkModel* model, |
| 49 const BookmarkNode* node) {} | 50 const BookmarkNode* node) {} |
| 50 | 51 |
| 51 private: | 52 private: |
| 52 DISALLOW_COPY_AND_ASSIGN(BookmarkLoadObserver); | 53 DISALLOW_COPY_AND_ASSIGN(BookmarkLoadObserver); |
| 53 }; | 54 }; |
| 54 | 55 |
| 56 LiveBookmarksSyncTest::LiveBookmarksSyncTest() { |
| 57 } |
| 58 |
| 59 LiveBookmarksSyncTest::~LiveBookmarksSyncTest() { |
| 60 } |
| 61 |
| 55 // static | 62 // static |
| 56 void LiveBookmarksSyncTest::BlockUntilLoaded(BookmarkModel* m) { | 63 void LiveBookmarksSyncTest::BlockUntilLoaded(BookmarkModel* m) { |
| 57 if (m->IsLoaded()) | 64 if (m->IsLoaded()) |
| 58 return; | 65 return; |
| 59 BookmarkLoadObserver observer; | 66 BookmarkLoadObserver observer; |
| 60 m->AddObserver(&observer); | 67 m->AddObserver(&observer); |
| 61 ui_test_utils::RunMessageLoop(); | 68 ui_test_utils::RunMessageLoop(); |
| 62 m->RemoveObserver(&observer); | 69 m->RemoveObserver(&observer); |
| 63 ASSERT_TRUE(m->IsLoaded()); | 70 ASSERT_TRUE(m->IsLoaded()); |
| 64 } | 71 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 86 net::RuleBasedHostResolverProc* resolver = | 93 net::RuleBasedHostResolverProc* resolver = |
| 87 new net::RuleBasedHostResolverProc(host_resolver()); | 94 new net::RuleBasedHostResolverProc(host_resolver()); |
| 88 resolver->AllowDirectLookup("*.google.com"); | 95 resolver->AllowDirectLookup("*.google.com"); |
| 89 mock_host_resolver_override_.reset( | 96 mock_host_resolver_override_.reset( |
| 90 new net::ScopedDefaultHostResolverProc(resolver)); | 97 new net::ScopedDefaultHostResolverProc(resolver)); |
| 91 } | 98 } |
| 92 | 99 |
| 93 void LiveBookmarksSyncTest::TearDownInProcessBrowserTestFixture() { | 100 void LiveBookmarksSyncTest::TearDownInProcessBrowserTestFixture() { |
| 94 mock_host_resolver_override_.reset(); | 101 mock_host_resolver_override_.reset(); |
| 95 } | 102 } |
| OLD | NEW |