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

Side by Side Diff: components/web_modal/web_contents_modal_dialog_manager_unittest.cc

Issue 14197014: Add TestBrowserThreadBundle into RenderViewHostTestHarness. Kill some unnecessary real threads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merged ToT 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) 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 "components/web_modal/native_web_contents_modal_dialog_manager.h" 5 #include "components/web_modal/native_web_contents_modal_dialog_manager.h"
6 #include "components/web_modal/web_contents_modal_dialog_manager.h" 6 #include "components/web_modal/web_contents_modal_dialog_manager.h"
7 #include "content/public/test/test_browser_thread.h" 7 #include "content/public/browser/browser_thread.h"
8 #include "content/public/test/test_renderer_host.h" 8 #include "content/public/test/test_renderer_host.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 using content::BrowserThread; 11 using content::BrowserThread;
12 12
13 namespace web_modal { 13 namespace web_modal {
14 14
15 class WebContentsModalDialogManagerTest 15 class WebContentsModalDialogManagerTest
16 : public content::RenderViewHostTestHarness { 16 : public content::RenderViewHostTestHarness {
17 public: 17 public:
18 WebContentsModalDialogManagerTest()
19 : ui_thread_(BrowserThread::UI, &message_loop_) {
20 }
21
22 virtual void SetUp() { 18 virtual void SetUp() {
23 content::RenderViewHostTestHarness::SetUp(); 19 content::RenderViewHostTestHarness::SetUp();
24 WebContentsModalDialogManager::CreateForWebContents(web_contents()); 20 WebContentsModalDialogManager::CreateForWebContents(web_contents());
25 } 21 }
26
27 private:
28 content::TestBrowserThread ui_thread_;
29 }; 22 };
30 23
31 class NativeWebContentsModalDialogManagerCloseTest 24 class NativeWebContentsModalDialogManagerCloseTest
32 : public NativeWebContentsModalDialogManager { 25 : public NativeWebContentsModalDialogManager {
33 public: 26 public:
34 NativeWebContentsModalDialogManagerCloseTest( 27 NativeWebContentsModalDialogManagerCloseTest(
35 NativeWebContentsModalDialogManagerDelegate* delegate) 28 NativeWebContentsModalDialogManagerDelegate* delegate)
36 : delegate_(delegate) {} 29 : delegate_(delegate) {}
37 virtual void ManageDialog(NativeWebContentsModalDialog dialog) OVERRIDE { 30 virtual void ManageDialog(NativeWebContentsModalDialog dialog) OVERRIDE {
38 } 31 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // reinterpret_cast is valid. 72 // reinterpret_cast is valid.
80 web_contents_modal_dialog_manager->ShowDialog( 73 web_contents_modal_dialog_manager->ShowDialog(
81 reinterpret_cast<NativeWebContentsModalDialog>(i)); 74 reinterpret_cast<NativeWebContentsModalDialog>(i));
82 EXPECT_EQ(native_manager->close_count, 0); 75 EXPECT_EQ(native_manager->close_count, 0);
83 76
84 test_api.CloseAllDialogs(); 77 test_api.CloseAllDialogs();
85 EXPECT_EQ(native_manager->close_count, kWindowCount); 78 EXPECT_EQ(native_manager->close_count, kWindowCount);
86 } 79 }
87 80
88 } // namespace web_modal 81 } // namespace web_modal
OLDNEW
« no previous file with comments | « components/visitedlink/test/visitedlink_unittest.cc ('k') | content/browser/browser_thread_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698