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

Side by Side Diff: chrome/browser/ui/views/extensions/chooser_dialog_view_unittest.cc

Issue 2242943002: Update device name in chooser when device changes name (desktops) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address more comments Created 4 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/ui/views/extensions/chooser_dialog_view.h" 5 #include "chrome/browser/ui/views/extensions/chooser_dialog_view.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/chooser_controller/mock_chooser_controller.h" 9 #include "chrome/browser/chooser_controller/mock_chooser_controller.h"
10 #include "chrome/browser/ui/views/chooser_content_view.h" 10 #include "chrome/browser/ui/views/chooser_content_view.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 EXPECT_TRUE(ok_button_->enabled()); 165 EXPECT_TRUE(ok_button_->enabled());
166 EXPECT_TRUE(cancel_button_->enabled()); 166 EXPECT_TRUE(cancel_button_->enabled());
167 167
168 // Remove option 1. 168 // Remove option 1.
169 mock_chooser_controller_->OptionRemoved(base::ASCIIToUTF16("b")); 169 mock_chooser_controller_->OptionRemoved(base::ASCIIToUTF16("b"));
170 // OK button is disabled since the selected option is removed. 170 // OK button is disabled since the selected option is removed.
171 EXPECT_FALSE(ok_button_->enabled()); 171 EXPECT_FALSE(ok_button_->enabled());
172 EXPECT_TRUE(cancel_button_->enabled()); 172 EXPECT_TRUE(cancel_button_->enabled());
173 } 173 }
174 174
175 TEST_F(ChooserDialogViewTest, SelectAnOptionAndUpdateTheSelectedOption) {
176 mock_chooser_controller_->OptionAdded(base::ASCIIToUTF16("a"));
177 mock_chooser_controller_->OptionAdded(base::ASCIIToUTF16("b"));
178 mock_chooser_controller_->OptionAdded(base::ASCIIToUTF16("c"));
179 EXPECT_FALSE(ok_button_->enabled());
180 EXPECT_TRUE(cancel_button_->enabled());
181
182 // Select option 1.
183 table_view_->Select(1);
184 EXPECT_TRUE(ok_button_->enabled());
185 EXPECT_TRUE(cancel_button_->enabled());
186
187 // Update option 1.
188 mock_chooser_controller_->OptionUpdated(base::ASCIIToUTF16("b"),
189 base::ASCIIToUTF16("d"));
190 EXPECT_TRUE(ok_button_->enabled());
191 EXPECT_TRUE(cancel_button_->enabled());
192
193 // Remove option 1.
194 mock_chooser_controller_->OptionRemoved(base::ASCIIToUTF16("d"));
195 EXPECT_FALSE(ok_button_->enabled());
196 EXPECT_TRUE(cancel_button_->enabled());
197 }
198
175 TEST_F(ChooserDialogViewTest, 199 TEST_F(ChooserDialogViewTest,
176 AddAnOptionAndSelectItAndRemoveTheSelectedOption) { 200 AddAnOptionAndSelectItAndRemoveTheSelectedOption) {
177 mock_chooser_controller_->OptionAdded(base::ASCIIToUTF16("a")); 201 mock_chooser_controller_->OptionAdded(base::ASCIIToUTF16("a"));
178 EXPECT_FALSE(ok_button_->enabled()); 202 EXPECT_FALSE(ok_button_->enabled());
179 EXPECT_TRUE(cancel_button_->enabled()); 203 EXPECT_TRUE(cancel_button_->enabled());
180 204
181 // Select option 0. 205 // Select option 0.
182 table_view_->Select(0); 206 table_view_->Select(0);
183 EXPECT_TRUE(ok_button_->enabled()); 207 EXPECT_TRUE(ok_button_->enabled());
184 EXPECT_TRUE(cancel_button_->enabled()); 208 EXPECT_TRUE(cancel_button_->enabled());
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 EXPECT_TRUE(cancel_button_->enabled()); 293 EXPECT_TRUE(cancel_button_->enabled());
270 table_view_->Select(0); 294 table_view_->Select(0);
271 EXPECT_TRUE(ok_button_->enabled()); 295 EXPECT_TRUE(ok_button_->enabled());
272 EXPECT_TRUE(cancel_button_->enabled()); 296 EXPECT_TRUE(cancel_button_->enabled());
273 297
274 mock_chooser_controller_->OnDiscoveryStateChanged( 298 mock_chooser_controller_->OnDiscoveryStateChanged(
275 content::BluetoothChooser::DiscoveryState::IDLE); 299 content::BluetoothChooser::DiscoveryState::IDLE);
276 EXPECT_TRUE(ok_button_->enabled()); 300 EXPECT_TRUE(ok_button_->enabled());
277 EXPECT_TRUE(cancel_button_->enabled()); 301 EXPECT_TRUE(cancel_button_->enabled());
278 } 302 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698