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

Side by Side Diff: chrome/browser/geolocation/geolocation_infobar_queue_controller_unittest.cc

Issue 11189026: Remove TabContents from geolocation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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
« no previous file with comments | « chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/synchronization/waitable_event.h" 5 #include "base/synchronization/waitable_event.h"
6 #include "chrome/browser/geolocation/geolocation_infobar_queue_controller.h" 6 #include "chrome/browser/geolocation/geolocation_infobar_queue_controller.h"
7 #include "chrome/browser/ui/tab_contents/test_tab_contents.h" 7 #include "chrome/browser/infobars/infobar_tab_helper.h"
8 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
8 #include "chrome/test/base/testing_profile.h" 9 #include "chrome/test/base/testing_profile.h"
9 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
10 #include "content/public/test/mock_render_process_host.h" 11 #include "content/public/test/mock_render_process_host.h"
11 #include "content/public/test/test_browser_thread.h" 12 #include "content/public/test/test_browser_thread.h"
12 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
13 14
14 class GeolocationInfoBarQueueControllerTests : public TabContentsTestHarness { 15 class GeolocationInfoBarQueueControllerTests
16 : public ChromeRenderViewHostTestHarness {
15 public: 17 public:
16 GeolocationInfoBarQueueControllerTests(); 18 GeolocationInfoBarQueueControllerTests();
17 19
18 protected: 20 protected:
19 int ProcessId(); 21 int ProcessId();
20 int RenderId(); 22 int RenderId();
21 23
22 private: 24 private:
25 // ChromeRenderViewHostTestHarness:
26 virtual void SetUp() OVERRIDE;
27
23 content::TestBrowserThread ui_thread_; 28 content::TestBrowserThread ui_thread_;
24 29
25 DISALLOW_COPY_AND_ASSIGN(GeolocationInfoBarQueueControllerTests); 30 DISALLOW_COPY_AND_ASSIGN(GeolocationInfoBarQueueControllerTests);
26 }; 31 };
27 32
28 GeolocationInfoBarQueueControllerTests::GeolocationInfoBarQueueControllerTests() 33 GeolocationInfoBarQueueControllerTests::GeolocationInfoBarQueueControllerTests()
29 : ui_thread_(content::BrowserThread::UI, MessageLoop::current()) { 34 : ui_thread_(content::BrowserThread::UI, MessageLoop::current()) {
30 } 35 }
31 36
32 int GeolocationInfoBarQueueControllerTests::ProcessId() { 37 int GeolocationInfoBarQueueControllerTests::ProcessId() {
33 return contents()->GetRenderProcessHost()->GetID(); 38 return contents()->GetRenderProcessHost()->GetID();
34 } 39 }
35 40
36 int GeolocationInfoBarQueueControllerTests::RenderId() { 41 int GeolocationInfoBarQueueControllerTests::RenderId() {
37 return contents()->GetRenderViewHost()->GetRoutingID(); 42 return contents()->GetRenderViewHost()->GetRoutingID();
38 } 43 }
39 44
45 void GeolocationInfoBarQueueControllerTests::SetUp() {
46 ChromeRenderViewHostTestHarness::SetUp();
47 InfoBarTabHelper::CreateForWebContents(web_contents());
48 }
49
40 class ObservationCountingQueueController : 50 class ObservationCountingQueueController :
41 public GeolocationInfoBarQueueController { 51 public GeolocationInfoBarQueueController {
42 public: 52 public:
43 explicit ObservationCountingQueueController(Profile* profile); 53 explicit ObservationCountingQueueController(Profile* profile);
44 54
45 int call_count() const { return call_count_; } 55 int call_count() const { return call_count_; }
46 56
47 private: 57 private:
48 int call_count_; 58 int call_count_;
49 59
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 ObservationCountingQueueController infobar_queue_controller(profile()); 111 ObservationCountingQueueController infobar_queue_controller(profile());
102 GURL url("http://www.example.com/geolocation"); 112 GURL url("http://www.example.com/geolocation");
103 base::Callback<void(bool)> callback; 113 base::Callback<void(bool)> callback;
104 infobar_queue_controller.CreateInfoBarRequest(ProcessId(), RenderId(), 1, 114 infobar_queue_controller.CreateInfoBarRequest(ProcessId(), RenderId(), 1,
105 url, url, callback); 115 url, url, callback);
106 infobar_queue_controller.CreateInfoBarRequest(ProcessId(), RenderId(), 2, 116 infobar_queue_controller.CreateInfoBarRequest(ProcessId(), RenderId(), 2,
107 url, url, callback); 117 url, url, callback);
108 infobar_queue_controller.CancelInfoBarRequest(ProcessId(), RenderId(), 1); 118 infobar_queue_controller.CancelInfoBarRequest(ProcessId(), RenderId(), 1);
109 EXPECT_EQ(1, infobar_queue_controller.call_count()); 119 EXPECT_EQ(1, infobar_queue_controller.call_count());
110 }; 120 };
OLDNEW
« no previous file with comments | « chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698