| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #import "base/mac/scoped_nsobject.h" | 8 #import "base/mac/scoped_nsobject.h" |
| 9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/permissions/permission_request_manager_test_api.h" | 10 #include "chrome/browser/permissions/permission_request_manager_test_api.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 void SetUpOnMainThread() override { | 73 void SetUpOnMainThread() override { |
| 74 // Make the browser active (ensures the app can receive key events). | 74 // Make the browser active (ensures the app can receive key events). |
| 75 EXPECT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 75 EXPECT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
| 76 | 76 |
| 77 test_api_ = | 77 test_api_ = |
| 78 base::MakeUnique<test::PermissionRequestManagerTestApi>(browser()); | 78 base::MakeUnique<test::PermissionRequestManagerTestApi>(browser()); |
| 79 EXPECT_TRUE(test_api_->manager()); | 79 EXPECT_TRUE(test_api_->manager()); |
| 80 | 80 |
| 81 test_api_->AddSimpleRequest(browser()->profile(), | 81 test_api_->AddSimpleRequest(browser()->profile(), |
| 82 content::PermissionType::GEOLOCATION); | 82 CONTENT_SETTINGS_TYPE_GEOLOCATION); |
| 83 | 83 |
| 84 EXPECT_TRUE([browser()->window()->GetNativeWindow() isKeyWindow]); | 84 EXPECT_TRUE([browser()->window()->GetNativeWindow() isKeyWindow]); |
| 85 test_api_->manager()->DisplayPendingRequests(); | 85 test_api_->manager()->DisplayPendingRequests(); |
| 86 | 86 |
| 87 // The bubble should steal key focus when shown. | 87 // The bubble should steal key focus when shown. |
| 88 EnsureWindowActive(test_api_->GetPromptWindow(), "show permission bubble"); | 88 EnsureWindowActive(test_api_->GetPromptWindow(), "show permission bubble"); |
| 89 } | 89 } |
| 90 | 90 |
| 91 protected: | 91 protected: |
| 92 std::unique_ptr<test::PermissionRequestManagerTestApi> test_api_; | 92 std::unique_ptr<test::PermissionRequestManagerTestApi> test_api_; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); | 170 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); |
| 171 [browser_window makeKeyAndOrderFront:nil]; | 171 [browser_window makeKeyAndOrderFront:nil]; |
| 172 EnsureWindowActive(browser_window, "switch away with curly brace"); | 172 EnsureWindowActive(browser_window, "switch away with curly brace"); |
| 173 EXPECT_FALSE(test_api_->GetPromptWindow()); | 173 EXPECT_FALSE(test_api_->GetPromptWindow()); |
| 174 } | 174 } |
| 175 | 175 |
| 176 INSTANTIATE_TEST_CASE_P(, | 176 INSTANTIATE_TEST_CASE_P(, |
| 177 PermissionBubbleInteractiveUITest, | 177 PermissionBubbleInteractiveUITest, |
| 178 ::testing::Values(UiMode::VIEWS, UiMode::COCOA), | 178 ::testing::Values(UiMode::VIEWS, UiMode::COCOA), |
| 179 &UiModeToString); | 179 &UiModeToString); |
| OLD | NEW |