network_portal_detector_impl_browsertest.cc revision effb81e5f8246d0db0270817048dc992db66e9fb
1a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved. 2a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 3a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// found in the LICENSE file. 4a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 5a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "base/compiler_specific.h" 6a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "base/macros.h" 7effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch#include "base/message_loop/message_loop.h" 8a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "base/run_loop.h" 9a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "chrome/browser/browser_process.h" 10a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "chrome/browser/captive_portal/testing_utils.h" 11a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "chrome/browser/chromeos/login/login_manager_test.h" 12a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "chrome/browser/chromeos/login/startup_utils.h" 13a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "chrome/browser/chromeos/net/network_portal_detector.h" 14a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "chrome/browser/chromeos/net/network_portal_detector_impl.h" 15a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "chrome/browser/chromeos/net/network_portal_detector_strategy.h" 16effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch#include "chrome/browser/chromeos/net/network_portal_detector_test_utils.h" 17a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "chromeos/chromeos_switches.h" 18a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "chromeos/dbus/dbus_thread_manager.h" 19a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "chromeos/dbus/shill_service_client.h" 20a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "content/public/test/test_utils.h" 21a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "dbus/object_path.h" 22a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "third_party/cros_system_api/dbus/service_constants.h" 23a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "ui/message_center/message_center.h" 24effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch#include "ui/message_center/message_center_observer.h" 25effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch 26effb81e5f8246d0db0270817048dc992db66e9fbBen Murdochusing base::MessageLoop; 27effb81e5f8246d0db0270817048dc992db66e9fbBen Murdochusing message_center::MessageCenter; 28effb81e5f8246d0db0270817048dc992db66e9fbBen Murdochusing message_center::MessageCenterObserver; 29a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 30a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)namespace chromeos { 31a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 32a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)namespace { 33a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 34effb81e5f8246d0db0270817048dc992db66e9fbBen Murdochconst char* kNotificationId = 35effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch NetworkPortalNotificationController::kNotificationId; 36effb81e5f8246d0db0270817048dc992db66e9fbBen Murdochconst char* kNotificationMetric = 37effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch NetworkPortalNotificationController::kNotificationMetric; 38effb81e5f8246d0db0270817048dc992db66e9fbBen Murdochconst char* kUserActionMetric = 39effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch NetworkPortalNotificationController::kUserActionMetric; 40effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch 41a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)const char kTestUser[] = "test-user@gmail.com"; 42a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)const char kWifi[] = "wifi"; 43a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 44a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)void ErrorCallbackFunction(const std::string& error_name, 45a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) const std::string& error_message) { 46a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) CHECK(false) << "Shill Error: " << error_name << " : " << error_message; 47a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 48a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 49a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)void SetConnected(const std::string& service_path) { 50a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) DBusThreadManager::Get()->GetShillServiceClient()->Connect( 51a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) dbus::ObjectPath(service_path), 52a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) base::Bind(&base::DoNothing), 53a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) base::Bind(&ErrorCallbackFunction)); 54a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) base::RunLoop().RunUntilIdle(); 55a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 56a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 57effb81e5f8246d0db0270817048dc992db66e9fbBen Murdochclass TestObserver : public MessageCenterObserver { 58effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch public: 59effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch TestObserver() : run_loop_(new base::RunLoop()) { 60effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch MessageCenter::Get()->AddObserver(this); 61effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch } 62effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch 63effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch virtual ~TestObserver() { 64effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch MessageCenter::Get()->RemoveObserver(this); 65effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch } 66effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch 67effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch void WaitAndReset() { 68effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch run_loop_->Run(); 69effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch run_loop_.reset(new base::RunLoop()); 70effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch } 71effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch 72effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch virtual void OnNotificationDisplayed(const std::string& notification_id) 73effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch OVERRIDE { 74effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch if (notification_id == kNotificationId) 75effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch MessageLoop::current()->PostTask(FROM_HERE, run_loop_->QuitClosure()); 76effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch } 77effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch 78effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch virtual void OnNotificationRemoved(const std::string& notification_id, 79effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch bool by_user) OVERRIDE { 80effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch if (notification_id == kNotificationId && by_user) 81effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch MessageLoop::current()->PostTask(FROM_HERE, run_loop_->QuitClosure()); 82effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch } 83effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch 84effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch private: 85effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch scoped_ptr<base::RunLoop> run_loop_; 86effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch 87effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch DISALLOW_COPY_AND_ASSIGN(TestObserver); 88effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch}; 89effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch 90a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} // namespace 91a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 92a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)class NetworkPortalDetectorImplBrowserTest 93a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) : public LoginManagerTest, 94a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) public captive_portal::CaptivePortalDetectorTestBase { 95a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) public: 96a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) NetworkPortalDetectorImplBrowserTest() 97a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) : LoginManagerTest(false), network_portal_detector_(NULL) {} 98a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) virtual ~NetworkPortalDetectorImplBrowserTest() {} 99a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 100a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) virtual void SetUpOnMainThread() OVERRIDE { 101a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) LoginManagerTest::SetUpOnMainThread(); 102a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 103a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) ShillServiceClient::TestInterface* service_test = 104a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); 105a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) service_test->ClearServices(); 106a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) service_test->AddService(kWifi, 107a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) kWifi, 108a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) shill::kTypeEthernet, 109a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) shill::kStateIdle, 110a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) true /* add_to_visible */, 111a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) true /* add_to_watchlist */); 112a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) DBusThreadManager::Get()->GetShillServiceClient()->SetProperty( 113a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) dbus::ObjectPath(kWifi), 114a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) shill::kStateProperty, 115a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) base::StringValue(shill::kStatePortal), 116a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) base::Bind(&base::DoNothing), 117a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) base::Bind(&ErrorCallbackFunction)); 118a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 119a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) network_portal_detector_ = new NetworkPortalDetectorImpl( 120a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) g_browser_process->system_request_context()); 121a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) NetworkPortalDetector::InitializeForTesting(network_portal_detector_); 122a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) network_portal_detector_->Enable(false /* start_detection */); 123a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) set_detector(network_portal_detector_->captive_portal_detector_.get()); 124a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PortalDetectorStrategy::set_delay_till_next_attempt_for_testing( 125a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) base::TimeDelta()); 126a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) base::RunLoop().RunUntilIdle(); 127a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) } 128a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 129a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) void RestartDetection() { 130a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) network_portal_detector_->StopDetection(); 131a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) network_portal_detector_->StartDetection(); 132a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) base::RunLoop().RunUntilIdle(); 133a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) } 134a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 135a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PortalDetectorStrategy* strategy() { 136a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return network_portal_detector_->strategy_.get(); 137a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) } 138a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 139effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch MessageCenter* message_center() { return MessageCenter::Get(); } 140effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch 141a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) private: 142a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) NetworkPortalDetectorImpl* network_portal_detector_; 143a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 144a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(NetworkPortalDetectorImplBrowserTest); 145a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}; 146a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 147a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)IN_PROC_BROWSER_TEST_F(NetworkPortalDetectorImplBrowserTest, 148a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) PRE_InSessionDetection) { 149a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) RegisterUser(kTestUser); 150a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) StartupUtils::MarkOobeCompleted(); 151a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) ASSERT_EQ(PortalDetectorStrategy::STRATEGY_ID_LOGIN_SCREEN, strategy()->Id()); 152a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 153a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 154a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)IN_PROC_BROWSER_TEST_F(NetworkPortalDetectorImplBrowserTest, 155a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) InSessionDetection) { 156effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch typedef NetworkPortalNotificationController Controller; 157effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch 158effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch TestObserver observer; 159effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch 160effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch EnumHistogramChecker ui_checker( 161effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch kNotificationMetric, Controller::NOTIFICATION_METRIC_COUNT, NULL); 162effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch EnumHistogramChecker action_checker( 163effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch kUserActionMetric, Controller::USER_ACTION_METRIC_COUNT, NULL); 164effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch 165a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) LoginUser(kTestUser); 166a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) content::RunAllPendingInMessageLoop(); 167effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch 168effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch // User connects to wifi. 169a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) SetConnected(kWifi); 170a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 171a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) ASSERT_EQ(PortalDetectorStrategy::STRATEGY_ID_SESSION, strategy()->Id()); 172a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 173a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // No notification until portal detection is completed. 174effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch ASSERT_FALSE(message_center()->HasNotification(kNotificationId)); 175a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) RestartDetection(); 176a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) CompleteURLFetch(net::OK, 200, NULL); 177a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 178a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // Check that wifi is marked as behind the portal and that notification 179a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // is displayed. 180effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch ASSERT_TRUE(message_center()->HasNotification(kNotificationId)); 181a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) ASSERT_EQ(NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL, 182a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) NetworkPortalDetector::Get()->GetCaptivePortalState(kWifi).status); 183effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch 184effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch // Wait until notification is displayed. 185effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch observer.WaitAndReset(); 186effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch 187effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch ASSERT_TRUE( 188effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch ui_checker.Expect(Controller::NOTIFICATION_METRIC_DISPLAYED, 1)->Check()); 189effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch ASSERT_TRUE(action_checker.Check()); 190effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch 191effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch // User explicitly closes the notification. 192effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch message_center()->RemoveNotification(kNotificationId, true); 193effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch 194effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch // Wait until notification is closed. 195effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch observer.WaitAndReset(); 196effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch 197effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch ASSERT_TRUE(ui_checker.Check()); 198effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch ASSERT_TRUE( 199effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch action_checker.Expect(Controller::USER_ACTION_METRIC_CLOSED, 1)->Check()); 200a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 201a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 202a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} // namespace chromeos 203