| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/app_mode/kiosk_app_manager.h" | 5 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "base/prefs/scoped_user_pref_update.h" | 11 #include "base/prefs/scoped_user_pref_update.h" |
| 12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 15 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager_observer.h" | 15 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager_observer.h" |
| 16 #include "chrome/browser/chromeos/policy/device_local_account.h" | 16 #include "chrome/browser/chromeos/policy/device_local_account.h" |
| 17 #include "chrome/browser/chromeos/settings/cros_settings.h" | 17 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 18 #include "chrome/browser/policy/browser_policy_connector.h" | 18 #include "chrome/browser/policy/browser_policy_connector.h" |
| 19 #include "chrome/common/chrome_paths.h" | 19 #include "chrome/common/chrome_paths.h" |
| 20 #include "chrome/common/chrome_switches.h" | |
| 21 #include "chrome/test/base/in_process_browser_test.h" | 20 #include "chrome/test/base/in_process_browser_test.h" |
| 22 #include "chromeos/settings/cros_settings_names.h" | 21 #include "chromeos/settings/cros_settings_names.h" |
| 23 #include "content/public/test/test_utils.h" | 22 #include "content/public/test/test_utils.h" |
| 23 #include "extensions/common/switches.h" |
| 24 #include "net/base/host_port_pair.h" | 24 #include "net/base/host_port_pair.h" |
| 25 #include "net/dns/mock_host_resolver.h" | 25 #include "net/dns/mock_host_resolver.h" |
| 26 | 26 |
| 27 namespace chromeos { | 27 namespace chromeos { |
| 28 | 28 |
| 29 namespace { | 29 namespace { |
| 30 | 30 |
| 31 const char kWebstoreDomain[] = "cws.com"; | 31 const char kWebstoreDomain[] = "cws.com"; |
| 32 | 32 |
| 33 // Helper KioskAppManager::GetConsumerKioskModeStatusCallback implementation. | 33 // Helper KioskAppManager::GetConsumerKioskModeStatusCallback implementation. |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // We start the test server now instead of in | 142 // We start the test server now instead of in |
| 143 // SetUpInProcessBrowserTestFixture so that we can get its port number. | 143 // SetUpInProcessBrowserTestFixture so that we can get its port number. |
| 144 ASSERT_TRUE(test_server()->Start()); | 144 ASSERT_TRUE(test_server()->Start()); |
| 145 | 145 |
| 146 net::HostPortPair host_port = test_server()->host_port_pair(); | 146 net::HostPortPair host_port = test_server()->host_port_pair(); |
| 147 test_gallery_url_ = base::StringPrintf( | 147 test_gallery_url_ = base::StringPrintf( |
| 148 "http://%s:%d/files/chromeos/app_mode/webstore", | 148 "http://%s:%d/files/chromeos/app_mode/webstore", |
| 149 kWebstoreDomain, host_port.port()); | 149 kWebstoreDomain, host_port.port()); |
| 150 | 150 |
| 151 command_line->AppendSwitchASCII( | 151 command_line->AppendSwitchASCII( |
| 152 switches::kAppsGalleryURL, test_gallery_url_); | 152 extensions::switches::kAppsGalleryURL, test_gallery_url_); |
| 153 } | 153 } |
| 154 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 154 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| 155 host_resolver()->AddRule(kWebstoreDomain, "127.0.0.1"); | 155 host_resolver()->AddRule(kWebstoreDomain, "127.0.0.1"); |
| 156 } | 156 } |
| 157 | 157 |
| 158 std::string GetAppIds() const { | 158 std::string GetAppIds() const { |
| 159 KioskAppManager::Apps apps; | 159 KioskAppManager::Apps apps; |
| 160 manager()->GetApps(&apps); | 160 manager()->GetApps(&apps); |
| 161 | 161 |
| 162 std::string str; | 162 std::string str; |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 new content::MessageLoopRunner; | 406 new content::MessageLoopRunner; |
| 407 manager()->GetConsumerKioskModeStatus( | 407 manager()->GetConsumerKioskModeStatus( |
| 408 base::Bind(&ConsumerKioskModeStatusCheck, | 408 base::Bind(&ConsumerKioskModeStatusCheck, |
| 409 status.get(), | 409 status.get(), |
| 410 runner3->QuitClosure())); | 410 runner3->QuitClosure())); |
| 411 runner3->Run(); | 411 runner3->Run(); |
| 412 EXPECT_EQ(*status.get(), KioskAppManager::CONSUMER_KIOSK_MODE_DISABLED); | 412 EXPECT_EQ(*status.get(), KioskAppManager::CONSUMER_KIOSK_MODE_DISABLED); |
| 413 } | 413 } |
| 414 | 414 |
| 415 } // namespace chromeos | 415 } // namespace chromeos |
| OLD | NEW |