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

Side by Side Diff: android_webview/browser/aw_permission_manager_unittest.cc

Issue 2485253002: Remove unnecessary calls to GURL() (Closed)
Patch Set: Assert that StringPiece must always be canonicalized. Fix some constants. Created 4 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
« no previous file with comments | « no previous file | chrome/browser/bookmarks/managed_bookmark_service_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "android_webview/browser/aw_permission_manager.h" 5 #include "android_webview/browser/aw_permission_manager.h"
6 6
7 #include <list> 7 #include <list>
8 #include <memory> 8 #include <memory>
9 9
10 #include "android_webview/browser/aw_browser_permission_request_delegate.h" 10 #include "android_webview/browser/aw_browser_permission_request_delegate.h"
(...skipping 10 matching lines...) Expand all
21 using content::PermissionType; 21 using content::PermissionType;
22 22
23 namespace android_webview { 23 namespace android_webview {
24 24
25 namespace { 25 namespace {
26 26
27 int kNoPendingOperation = -1; 27 int kNoPendingOperation = -1;
28 28
29 int kRenderProcessIDForTesting = 8; 29 int kRenderProcessIDForTesting = 8;
30 int kRenderFrameIDForTesting = 19; 30 int kRenderFrameIDForTesting = 19;
31 const char kEmbeddingOrigin[] = "https://www.google.com"; 31 const char kEmbeddingOrigin[] = "https://www.google.com/";
32 const char kRequestingOrigin1[] = "https://www.google.com"; 32 const char kRequestingOrigin1[] = "https://www.google.com/";
33 const char kRequestingOrigin2[] = "https://www.chromium.org"; 33 const char kRequestingOrigin2[] = "https://www.chromium.org/";
34 34
35 class AwBrowserPermissionRequestDelegateForTesting 35 class AwBrowserPermissionRequestDelegateForTesting
36 : public AwBrowserPermissionRequestDelegate { 36 : public AwBrowserPermissionRequestDelegate {
37 public: 37 public:
38 void EnqueueResponse(const std::string& origin, 38 void EnqueueResponse(const std::string& origin,
39 PermissionType type, 39 PermissionType type,
40 bool grant) { 40 bool grant) {
41 for (auto it = request_.begin(); it != request_.end(); ++it) { 41 for (auto it = request_.begin(); it != request_.end(); ++it) {
42 if ((*it)->type != type || (*it)->origin != GURL(origin)) 42 if ((*it)->type != type || (*it)->origin != origin)
43 continue; 43 continue;
44 const base::Callback<void(bool)> callback = (*it)->callback; 44 const base::Callback<void(bool)> callback = (*it)->callback;
45 request_.erase(it); 45 request_.erase(it);
46 callback.Run(grant); 46 callback.Run(grant);
47 return; 47 return;
48 } 48 }
49 response_.push_back(MakeUnique<Response>(origin, type, grant)); 49 response_.push_back(MakeUnique<Response>(origin, type, grant));
50 } 50 }
51 51
52 // AwBrowserPermissionRequestDelegate: 52 // AwBrowserPermissionRequestDelegate:
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 EXPECT_EQ(2u, resolved_permission_status.size()); 889 EXPECT_EQ(2u, resolved_permission_status.size());
890 EXPECT_EQ(PermissionStatus::GRANTED, resolved_permission_status[0]); 890 EXPECT_EQ(PermissionStatus::GRANTED, resolved_permission_status[0]);
891 EXPECT_EQ(2, resolved_permission_request_id[0]); 891 EXPECT_EQ(2, resolved_permission_request_id[0]);
892 EXPECT_EQ(PermissionStatus::GRANTED, resolved_permission_status[1]); 892 EXPECT_EQ(PermissionStatus::GRANTED, resolved_permission_status[1]);
893 EXPECT_EQ(2, resolved_permission_request_id[1]); 893 EXPECT_EQ(2, resolved_permission_request_id[1]);
894 } 894 }
895 895
896 } // namespace 896 } // namespace
897 897
898 } // namespace android_webview 898 } // namespace android_webview
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/bookmarks/managed_bookmark_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698