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

Side by Side Diff: chrome/browser/importer/ie_importer_unittest_win.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 6
7 // The order of these includes is important. 7 // The order of these includes is important.
8 #include <windows.h> 8 #include <windows.h>
9 #include <unknwn.h> 9 #include <unknwn.h>
10 #include <intshcut.h> 10 #include <intshcut.h>
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 history_count_ = 0; 264 history_count_ = 0;
265 password_count_ = 0; 265 password_count_ = 0;
266 favicon_count_ = 0; 266 favicon_count_ = 0;
267 } 267 }
268 268
269 // importer::ImporterProgressObserver: 269 // importer::ImporterProgressObserver:
270 virtual void ImportStarted() OVERRIDE {} 270 virtual void ImportStarted() OVERRIDE {}
271 virtual void ImportItemStarted(importer::ImportItem item) OVERRIDE {} 271 virtual void ImportItemStarted(importer::ImportItem item) OVERRIDE {}
272 virtual void ImportItemEnded(importer::ImportItem item) OVERRIDE {} 272 virtual void ImportItemEnded(importer::ImportItem item) OVERRIDE {}
273 virtual void ImportEnded() OVERRIDE { 273 virtual void ImportEnded() OVERRIDE {
274 MessageLoop::current()->Quit(); 274 base::MessageLoop::current()->Quit();
275 EXPECT_EQ(arraysize(kIEBookmarks), bookmark_count_); 275 EXPECT_EQ(arraysize(kIEBookmarks), bookmark_count_);
276 EXPECT_EQ(1, history_count_); 276 EXPECT_EQ(1, history_count_);
277 EXPECT_EQ(arraysize(kIEFaviconGroup), favicon_count_); 277 EXPECT_EQ(arraysize(kIEFaviconGroup), favicon_count_);
278 } 278 }
279 279
280 virtual bool BookmarkModelIsLoaded() const { 280 virtual bool BookmarkModelIsLoaded() const {
281 // Profile is ready for writing. 281 // Profile is ready for writing.
282 return true; 282 return true;
283 } 283 }
284 284
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 public: 369 public:
370 MalformedFavoritesRegistryTestObserver() : ProfileWriter(NULL) { 370 MalformedFavoritesRegistryTestObserver() : ProfileWriter(NULL) {
371 bookmark_count_ = 0; 371 bookmark_count_ = 0;
372 } 372 }
373 373
374 // importer::ImporterProgressObserver: 374 // importer::ImporterProgressObserver:
375 virtual void ImportStarted() OVERRIDE {} 375 virtual void ImportStarted() OVERRIDE {}
376 virtual void ImportItemStarted(importer::ImportItem item) OVERRIDE {} 376 virtual void ImportItemStarted(importer::ImportItem item) OVERRIDE {}
377 virtual void ImportItemEnded(importer::ImportItem item) OVERRIDE {} 377 virtual void ImportItemEnded(importer::ImportItem item) OVERRIDE {}
378 virtual void ImportEnded() OVERRIDE { 378 virtual void ImportEnded() OVERRIDE {
379 MessageLoop::current()->Quit(); 379 base::MessageLoop::current()->Quit();
380 EXPECT_EQ(arraysize(kIESortedBookmarks), bookmark_count_); 380 EXPECT_EQ(arraysize(kIESortedBookmarks), bookmark_count_);
381 } 381 }
382 382
383 virtual bool BookmarkModelIsLoaded() const { return true; } 383 virtual bool BookmarkModelIsLoaded() const { return true; }
384 virtual bool TemplateURLServiceIsLoaded() const { return true; } 384 virtual bool TemplateURLServiceIsLoaded() const { return true; }
385 385
386 virtual void AddPasswordForm(const content::PasswordForm& form) {} 386 virtual void AddPasswordForm(const content::PasswordForm& form) {}
387 virtual void AddHistoryPage(const history::URLRows& page, 387 virtual void AddHistoryPage(const history::URLRows& page,
388 history::VisitSource visit_source) {} 388 history::VisitSource visit_source) {}
389 virtual void AddKeyword(std::vector<TemplateURL*> template_url, 389 virtual void AddKeyword(std::vector<TemplateURL*> template_url,
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 495
496 // Sets up a special history link. 496 // Sets up a special history link.
497 base::win::ScopedComPtr<IUrlHistoryStg2> url_history_stg2; 497 base::win::ScopedComPtr<IUrlHistoryStg2> url_history_stg2;
498 res = url_history_stg2.CreateInstance(CLSID_CUrlHistory, NULL, 498 res = url_history_stg2.CreateInstance(CLSID_CUrlHistory, NULL,
499 CLSCTX_INPROC_SERVER); 499 CLSCTX_INPROC_SERVER);
500 ASSERT_TRUE(res == S_OK); 500 ASSERT_TRUE(res == S_OK);
501 res = url_history_stg2->AddUrl(kIEIdentifyUrl, kIEIdentifyTitle, 0); 501 res = url_history_stg2->AddUrl(kIEIdentifyUrl, kIEIdentifyTitle, 0);
502 ASSERT_TRUE(res == S_OK); 502 ASSERT_TRUE(res == S_OK);
503 503
504 // Starts to import the above settings. 504 // Starts to import the above settings.
505 MessageLoop* loop = MessageLoop::current(); 505 base::MessageLoop* loop = base::MessageLoop::current();
506 scoped_refptr<ImporterHost> host(new ImporterHost); 506 scoped_refptr<ImporterHost> host(new ImporterHost);
507 507
508 TestObserver* observer = new TestObserver(); 508 TestObserver* observer = new TestObserver();
509 host->SetObserver(observer); 509 host->SetObserver(observer);
510 importer::SourceProfile source_profile; 510 importer::SourceProfile source_profile;
511 source_profile.importer_type = importer::TYPE_IE; 511 source_profile.importer_type = importer::TYPE_IE;
512 source_profile.source_path = temp_dir_.path(); 512 source_profile.source_path = temp_dir_.path();
513 513
514 // IUrlHistoryStg2::AddUrl seems to reset the override. Ensure it here. 514 // IUrlHistoryStg2::AddUrl seems to reset the override. Ensure it here.
515 StartRegistryOverride(); 515 StartRegistryOverride();
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 // sort is performed. 575 // sort is performed.
576 for (size_t i = 0; i < arraysize(kBadBinary); ++i) { 576 for (size_t i = 0; i < arraysize(kBadBinary); ++i) {
577 base::win::RegKey key; 577 base::win::RegKey key;
578 ASSERT_EQ(ERROR_SUCCESS, 578 ASSERT_EQ(ERROR_SUCCESS,
579 key.Create(HKEY_CURRENT_USER, kIEFavoritesOrderKey, KEY_WRITE)); 579 key.Create(HKEY_CURRENT_USER, kIEFavoritesOrderKey, KEY_WRITE));
580 ASSERT_EQ(ERROR_SUCCESS, 580 ASSERT_EQ(ERROR_SUCCESS,
581 key.WriteValue(L"Order", kBadBinary[i].data, kBadBinary[i].length, 581 key.WriteValue(L"Order", kBadBinary[i].data, kBadBinary[i].length,
582 REG_BINARY)); 582 REG_BINARY));
583 583
584 // Starts to import the above settings. 584 // Starts to import the above settings.
585 MessageLoop* loop = MessageLoop::current(); 585 base::MessageLoop* loop = base::MessageLoop::current();
586 scoped_refptr<ImporterHost> host(new ImporterHost); 586 scoped_refptr<ImporterHost> host(new ImporterHost);
587 587
588 MalformedFavoritesRegistryTestObserver* observer = 588 MalformedFavoritesRegistryTestObserver* observer =
589 new MalformedFavoritesRegistryTestObserver(); 589 new MalformedFavoritesRegistryTestObserver();
590 host->SetObserver(observer); 590 host->SetObserver(observer);
591 importer::SourceProfile source_profile; 591 importer::SourceProfile source_profile;
592 source_profile.importer_type = importer::TYPE_IE; 592 source_profile.importer_type = importer::TYPE_IE;
593 source_profile.source_path = temp_dir_.path(); 593 source_profile.source_path = temp_dir_.path();
594 594
595 loop->PostTask(FROM_HERE, base::Bind( 595 loop->PostTask(FROM_HERE, base::Bind(
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 ASSERT_TRUE(ie7_password::GetUserPassFromData(decrypted_data1, &username, 643 ASSERT_TRUE(ie7_password::GetUserPassFromData(decrypted_data1, &username,
644 &password)); 644 &password));
645 EXPECT_EQ(L"abcdefgh", username); 645 EXPECT_EQ(L"abcdefgh", username);
646 EXPECT_EQ(L"abcdefghijkl", password); 646 EXPECT_EQ(L"abcdefghijkl", password);
647 647
648 ASSERT_TRUE(ie7_password::GetUserPassFromData(decrypted_data2, &username, 648 ASSERT_TRUE(ie7_password::GetUserPassFromData(decrypted_data2, &username,
649 &password)); 649 &password));
650 EXPECT_EQ(L"abcdefghi", username); 650 EXPECT_EQ(L"abcdefghi", username);
651 EXPECT_EQ(L"abcdefg", password); 651 EXPECT_EQ(L"abcdefg", password);
652 } 652 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698