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

Side by Side Diff: chrome/browser/chromeos/options/wifi_config_view_browsertest.cc

Issue 4169001: Rewritten parts of NetworkLibrary to work around memory corruption that prev... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/options/wifi_config_view.h" 5 #include "chrome/browser/chromeos/options/wifi_config_view.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" 9 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h"
10 #include "chrome/browser/chromeos/cros/mock_network_library.h" 10 #include "chrome/browser/chromeos/cros/mock_network_library.h"
(...skipping 14 matching lines...) Expand all
25 virtual void SetUpInProcessBrowserTestFixture() { 25 virtual void SetUpInProcessBrowserTestFixture() {
26 cros_mock_->InitStatusAreaMocks(); 26 cros_mock_->InitStatusAreaMocks();
27 cros_mock_->SetStatusAreaMocksExpectations(); 27 cros_mock_->SetStatusAreaMocksExpectations();
28 mock_network_library_ = cros_mock_->mock_network_library(); 28 mock_network_library_ = cros_mock_->mock_network_library();
29 } 29 }
30 }; 30 };
31 31
32 // Test that if nothing is changed, we don't call SaveWifiNetwork. 32 // Test that if nothing is changed, we don't call SaveWifiNetwork.
33 IN_PROC_BROWSER_TEST_F(WifiConfigViewTest, NoChangeSaveTest) { 33 IN_PROC_BROWSER_TEST_F(WifiConfigViewTest, NoChangeSaveTest) {
34 EXPECT_CALL(*mock_network_library_, SaveWifiNetwork(_)).Times(0); 34 EXPECT_CALL(*mock_network_library_, SaveWifiNetwork(_)).Times(0);
35 WifiConfigView* view = new WifiConfigView(NULL, WifiNetwork()); 35 scoped_ptr<WifiNetwork> network(new WifiNetwork());
36 WifiConfigView* view = new WifiConfigView(NULL, network.get());
36 view->Save(); 37 view->Save();
37 } 38 }
38 39
39 // Test that if autoconnect was changed, we call SaveWifiNetwork. 40 // Test that if autoconnect was changed, we call SaveWifiNetwork.
40 IN_PROC_BROWSER_TEST_F(WifiConfigViewTest, ChangeAutoConnectSaveTest) { 41 IN_PROC_BROWSER_TEST_F(WifiConfigViewTest, ChangeAutoConnectSaveTest) {
41 EXPECT_CALL(*mock_network_library_, SaveWifiNetwork(_)).Times(1); 42 EXPECT_CALL(*mock_network_library_, SaveWifiNetwork(_)).Times(1);
42 WifiNetwork remembered_network = WifiNetwork(); 43 scoped_ptr<WifiNetwork> remembered_network(new WifiNetwork());
43 remembered_network.set_favorite(true); 44 remembered_network->set_favorite(true);
44 WifiConfigView* view = new WifiConfigView(NULL, remembered_network); 45 WifiConfigView* view = new WifiConfigView(NULL, remembered_network.get());
45 ASSERT_TRUE(view->autoconnect_checkbox_ != NULL); 46 ASSERT_TRUE(view->autoconnect_checkbox_ != NULL);
46 view->autoconnect_checkbox_->SetChecked( 47 view->autoconnect_checkbox_->SetChecked(
47 !view->autoconnect_checkbox_->checked()); 48 !view->autoconnect_checkbox_->checked());
48 view->Save(); 49 view->Save();
49 } 50 }
50 51
51 // Test that if password was changed, we call SaveWifiNetwork. 52 // Test that if password was changed, we call SaveWifiNetwork.
52 IN_PROC_BROWSER_TEST_F(WifiConfigViewTest, ChangePasswordSaveTest) { 53 IN_PROC_BROWSER_TEST_F(WifiConfigViewTest, ChangePasswordSaveTest) {
53 EXPECT_CALL(*mock_network_library_, SaveWifiNetwork(_)).Times(1); 54 EXPECT_CALL(*mock_network_library_, SaveWifiNetwork(_)).Times(1);
54 WifiNetwork wifi = WifiNetwork(); 55 scoped_ptr<WifiNetwork> wifi(new WifiNetwork());
55 wifi.set_encryption(SECURITY_WEP); 56 wifi->set_encryption(SECURITY_WEP);
56 WifiConfigView* view = new WifiConfigView(NULL, wifi); 57 WifiConfigView* view = new WifiConfigView(NULL, wifi.get());
57 view->passphrase_textfield_->SetText(ASCIIToUTF16("test")); 58 view->passphrase_textfield_->SetText(ASCIIToUTF16("test"));
58 view->Save(); 59 view->Save();
59 } 60 }
60 61
61 } // namespace chromeos 62 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/options/wifi_config_view.cc ('k') | chrome/browser/chromeos/status/network_dropdown_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698