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

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: Created 7 years, 8 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_(BrowserThread::FILE_USER_BLOCKING,
55 BrowserThread::FILE_USER_BLOCKING, MessageLoop::current()), 55 base::MessageLoop::current()),
56 io_thread_(BrowserThread::IO, MessageLoop::current()) { 56 io_thread_(BrowserThread::IO, base::MessageLoop::current()) {}
57 }
58 57
59 void Navigate(const char* url, int page_id) { 58 void Navigate(const char* url, int page_id) {
60 WebContentsTester::For(web_contents())->TestDidNavigate( 59 WebContentsTester::For(web_contents())->TestDidNavigate(
61 web_contents()->GetRenderViewHost(), page_id, GURL(url), 60 web_contents()->GetRenderViewHost(), page_id, GURL(url),
62 content::PAGE_TRANSITION_TYPED); 61 content::PAGE_TRANSITION_TYPED);
63 } 62 }
64 63
65 void ShowInterstitial(const char* url) { 64 void ShowInterstitial(const char* url) {
66 (new TestMergeSessionLoadPage(web_contents(), GURL(url), this))->Show(); 65 (new TestMergeSessionLoadPage(web_contents(), GURL(url), this))->Show();
67 } 66 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 Navigate(kURL1, 1); 106 Navigate(kURL1, 1);
108 // Load next page. 107 // Load next page.
109 controller().LoadURL(GURL(kURL2), content::Referrer(), 108 controller().LoadURL(GURL(kURL2), content::Referrer(),
110 content::PAGE_TRANSITION_TYPED, std::string()); 109 content::PAGE_TRANSITION_TYPED, std::string());
111 110
112 // Simulate the load causing an merge session interstitial page 111 // Simulate the load causing an merge session interstitial page
113 // to be shown. 112 // to be shown.
114 ShowInterstitial(kURL2); 113 ShowInterstitial(kURL2);
115 InterstitialPage* interstitial = GetMergeSessionLoadPage(); 114 InterstitialPage* interstitial = GetMergeSessionLoadPage();
116 ASSERT_TRUE(interstitial); 115 ASSERT_TRUE(interstitial);
117 MessageLoop::current()->RunUntilIdle(); 116 base::MessageLoop::current()->RunUntilIdle();
118 117
119 // Simulate merge session completion. 118 // Simulate merge session completion.
120 UserManager::Get()->SetMergeSessionState( 119 UserManager::Get()->SetMergeSessionState(
121 UserManager::MERGE_STATUS_DONE); 120 UserManager::MERGE_STATUS_DONE);
122 MessageLoop::current()->RunUntilIdle(); 121 base::MessageLoop::current()->RunUntilIdle();
123 122
124 // The URL remains to be URL2. 123 // The URL remains to be URL2.
125 EXPECT_EQ(kURL2, web_contents()->GetURL().spec()); 124 EXPECT_EQ(kURL2, web_contents()->GetURL().spec());
126 125
127 // Commit navigation and the interstitial page is gone. 126 // Commit navigation and the interstitial page is gone.
128 Navigate(kURL2, 2); 127 Navigate(kURL2, 2);
129 EXPECT_FALSE(GetMergeSessionLoadPage()); 128 EXPECT_FALSE(GetMergeSessionLoadPage());
130 } 129 }
131 130
132 } // namespace chromeos 131 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698