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

Side by Side Diff: chrome/browser/chromeos/login/merge_session_load_page_unittest.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 years, 6 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/browser/chromeos/cros/cros_library.h" 5 #include "chrome/browser/chromeos/cros/cros_library.h"
6 #include "chrome/browser/chromeos/login/merge_session_load_page.h" 6 #include "chrome/browser/chromeos/login/merge_session_load_page.h"
7 #include "chrome/browser/chromeos/login/user_manager.h" 7 #include "chrome/browser/chromeos/login/user_manager.h"
8 #include "chrome/browser/chromeos/settings/cros_settings.h" 8 #include "chrome/browser/chromeos/settings/cros_settings.h"
9 #include "chrome/browser/chromeos/settings/device_settings_service.h" 9 #include "chrome/browser/chromeos/settings/device_settings_service.h"
10 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 10 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 private: 44 private:
45 MergeSessionLoadPageTest* test_page_; 45 MergeSessionLoadPageTest* test_page_;
46 46
47 DISALLOW_COPY_AND_ASSIGN(TestMergeSessionLoadPage); 47 DISALLOW_COPY_AND_ASSIGN(TestMergeSessionLoadPage);
48 }; 48 };
49 49
50 class MergeSessionLoadPageTest : public ChromeRenderViewHostTestHarness { 50 class MergeSessionLoadPageTest : public ChromeRenderViewHostTestHarness {
51 public: 51 public:
52 MergeSessionLoadPageTest() 52 MergeSessionLoadPageTest()
53 : ui_thread_(BrowserThread::UI, MessageLoop::current()), 53 : ui_thread_(BrowserThread::UI, base::MessageLoop::current()),
54 file_user_blocking_thread_( 54 file_user_blocking_thread_(
55 BrowserThread::FILE_USER_BLOCKING, MessageLoop::current()), 55 BrowserThread::FILE_USER_BLOCKING, base::MessageLoop::current()),
56 io_thread_(BrowserThread::IO, MessageLoop::current()) { 56 io_thread_(BrowserThread::IO, base::MessageLoop::current()) {
57 } 57 }
58 58
59 void Navigate(const char* url, int page_id) { 59 void Navigate(const char* url, int page_id) {
60 WebContentsTester::For(web_contents())->TestDidNavigate( 60 WebContentsTester::For(web_contents())->TestDidNavigate(
61 web_contents()->GetRenderViewHost(), page_id, GURL(url), 61 web_contents()->GetRenderViewHost(), page_id, GURL(url),
62 content::PAGE_TRANSITION_TYPED); 62 content::PAGE_TRANSITION_TYPED);
63 } 63 }
64 64
65 void ShowInterstitial(const char* url) { 65 void ShowInterstitial(const char* url) {
66 (new TestMergeSessionLoadPage(web_contents(), GURL(url), this))->Show(); 66 (new TestMergeSessionLoadPage(web_contents(), GURL(url), this))->Show();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 Navigate(kURL1, 1); 107 Navigate(kURL1, 1);
108 // Load next page. 108 // Load next page.
109 controller().LoadURL(GURL(kURL2), content::Referrer(), 109 controller().LoadURL(GURL(kURL2), content::Referrer(),
110 content::PAGE_TRANSITION_TYPED, std::string()); 110 content::PAGE_TRANSITION_TYPED, std::string());
111 111
112 // Simulate the load causing an merge session interstitial page 112 // Simulate the load causing an merge session interstitial page
113 // to be shown. 113 // to be shown.
114 ShowInterstitial(kURL2); 114 ShowInterstitial(kURL2);
115 InterstitialPage* interstitial = GetMergeSessionLoadPage(); 115 InterstitialPage* interstitial = GetMergeSessionLoadPage();
116 ASSERT_TRUE(interstitial); 116 ASSERT_TRUE(interstitial);
117 MessageLoop::current()->RunUntilIdle(); 117 base::MessageLoop::current()->RunUntilIdle();
118 118
119 // Simulate merge session completion. 119 // Simulate merge session completion.
120 UserManager::Get()->SetMergeSessionState( 120 UserManager::Get()->SetMergeSessionState(
121 UserManager::MERGE_STATUS_DONE); 121 UserManager::MERGE_STATUS_DONE);
122 MessageLoop::current()->RunUntilIdle(); 122 base::MessageLoop::current()->RunUntilIdle();
123 123
124 // The URL remains to be URL2. 124 // The URL remains to be URL2.
125 EXPECT_EQ(kURL2, web_contents()->GetURL().spec()); 125 EXPECT_EQ(kURL2, web_contents()->GetURL().spec());
126 126
127 // Commit navigation and the interstitial page is gone. 127 // Commit navigation and the interstitial page is gone.
128 Navigate(kURL2, 2); 128 Navigate(kURL2, 2);
129 EXPECT_FALSE(GetMergeSessionLoadPage()); 129 EXPECT_FALSE(GetMergeSessionLoadPage());
130 } 130 }
131 131
132 } // namespace chromeos 132 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/login_utils_browsertest.cc ('k') | chrome/browser/chromeos/login/mock_login_status_consumer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698