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

Side by Side Diff: chrome/browser/ui/intents/web_intent_picker_controller_browsertest.cc

Issue 10823424: Make sure controller is properly reset when the picker is closed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix browser tests. Created 8 years, 4 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/ui/intents/web_intent_picker_controller.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 <algorithm> 5 #include <algorithm>
6 #include <iterator> 6 #include <iterator>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 pending_async_completed_(false), 106 pending_async_completed_(false),
107 num_inline_disposition_(0), 107 num_inline_disposition_(0),
108 delegate_(NULL) { 108 delegate_(NULL) {
109 } 109 }
110 110
111 void MockClose() { 111 void MockClose() {
112 delegate_->OnClosing(); 112 delegate_->OnClosing();
113 } 113 }
114 114
115 // WebIntentPicker implementation. 115 // WebIntentPicker implementation.
116 virtual void Close() OVERRIDE {} 116 virtual void Close() OVERRIDE { StopWaiting(); }
117 virtual void SetActionString(const string16& action) OVERRIDE {} 117 virtual void SetActionString(const string16& action) OVERRIDE {}
118 virtual void OnExtensionInstallSuccess(const std::string& id) OVERRIDE { 118 virtual void OnExtensionInstallSuccess(const std::string& id) OVERRIDE {
119 num_extensions_installed_++; 119 num_extensions_installed_++;
120 } 120 }
121 virtual void OnExtensionInstallFailure(const std::string& id) OVERRIDE {} 121 virtual void OnExtensionInstallFailure(const std::string& id) OVERRIDE {}
122 virtual void OnInlineDispositionAutoResize(const gfx::Size& size) OVERRIDE {} 122 virtual void OnInlineDispositionAutoResize(const gfx::Size& size) OVERRIDE {}
123 virtual void OnPendingAsyncCompleted() OVERRIDE { 123 virtual void OnPendingAsyncCompleted() OVERRIDE {
124 StopWaiting(); 124 StopWaiting();
125 } 125 }
126 126
(...skipping 18 matching lines...) Expand all
145 void Wait() { 145 void Wait() {
146 if (!pending_async_completed_) { 146 if (!pending_async_completed_) {
147 message_loop_started_ = true; 147 message_loop_started_ = true;
148 content::RunMessageLoop(); 148 content::RunMessageLoop();
149 pending_async_completed_ = false; 149 pending_async_completed_ = false;
150 } 150 }
151 } 151 }
152 152
153 void StopWaiting() { 153 void StopWaiting() {
154 pending_async_completed_ = true; 154 pending_async_completed_ = true;
155 if (message_loop_started_) 155 if (message_loop_started_) {
156 message_loop_started_ = false;
156 MessageLoop::current()->Quit(); 157 MessageLoop::current()->Quit();
158 }
157 } 159 }
158 160
159 int num_installed_services_; 161 int num_installed_services_;
160 int num_icons_changed_; 162 int num_icons_changed_;
161 int num_extension_icons_changed_; 163 int num_extension_icons_changed_;
162 int num_extensions_installed_; 164 int num_extensions_installed_;
163 bool message_loop_started_; 165 bool message_loop_started_;
164 bool pending_async_completed_; 166 bool pending_async_completed_;
165 int num_inline_disposition_; 167 int num_inline_disposition_;
166 WebIntentPickerDelegate* delegate_; 168 WebIntentPickerDelegate* delegate_;
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 637
636 EXPECT_EQ(2, picker_.num_installed_services_); 638 EXPECT_EQ(2, picker_.num_installed_services_);
637 639
638 // The tab is shown immediately without needing to call OnServiceChosen. 640 // The tab is shown immediately without needing to call OnServiceChosen.
639 ASSERT_EQ(2, browser()->tab_count()); 641 ASSERT_EQ(2, browser()->tab_count());
640 EXPECT_EQ(GURL(kServiceURL1), 642 EXPECT_EQ(GURL(kServiceURL1),
641 chrome::GetActiveWebContents(browser())->GetURL()); 643 chrome::GetActiveWebContents(browser())->GetURL());
642 644
643 EXPECT_TRUE(dispatcher.dispatched_); 645 EXPECT_TRUE(dispatcher.dispatched_);
644 } 646 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/intents/web_intent_picker_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698