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

Side by Side Diff: chrome/browser/installable/installable_manager_browsertest.cc

Issue 2178833002: Add new app banner metrics using InstallableStatusCode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@banner-integrate-checker-no-refptr
Patch Set: Fix histogram name Created 4 years, 4 months 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
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 "chrome/browser/installable/installable_manager.h" 5 #include "chrome/browser/installable/installable_manager.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/threading/thread_task_runner_handle.h" 9 #include "base/threading/thread_task_runner_handle.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 error_code_ = data.error_code; 51 error_code_ = data.error_code;
52 manifest_url_ = data.manifest_url; 52 manifest_url_ = data.manifest_url;
53 manifest_ = data.manifest; 53 manifest_ = data.manifest;
54 icon_url_ = data.icon_url; 54 icon_url_ = data.icon_url;
55 if (data.icon) 55 if (data.icon)
56 icon_.reset(new SkBitmap(*data.icon)); 56 icon_.reset(new SkBitmap(*data.icon));
57 is_installable_ = data.is_installable; 57 is_installable_ = data.is_installable;
58 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, quit_closure_); 58 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, quit_closure_);
59 } 59 }
60 60
61 InstallableErrorCode error_code() const { return error_code_; } 61 InstallableStatusCode error_code() const { return error_code_; }
62 const GURL& manifest_url() const { return manifest_url_; } 62 const GURL& manifest_url() const { return manifest_url_; }
63 const content::Manifest& manifest() const { return manifest_; } 63 const content::Manifest& manifest() const { return manifest_; }
64 const GURL& icon_url() const { return icon_url_; } 64 const GURL& icon_url() const { return icon_url_; }
65 const SkBitmap* icon() const { return icon_.get(); } 65 const SkBitmap* icon() const { return icon_.get(); }
66 bool is_installable() const { return is_installable_; } 66 bool is_installable() const { return is_installable_; }
67 67
68 private: 68 private:
69 base::Closure quit_closure_; 69 base::Closure quit_closure_;
70 InstallableErrorCode error_code_; 70 InstallableStatusCode error_code_;
71 GURL manifest_url_; 71 GURL manifest_url_;
72 content::Manifest manifest_; 72 content::Manifest manifest_;
73 GURL icon_url_; 73 GURL icon_url_;
74 std::unique_ptr<SkBitmap> icon_; 74 std::unique_ptr<SkBitmap> icon_;
75 bool is_installable_; 75 bool is_installable_;
76 }; 76 };
77 77
78 class NestedCallbackTester { 78 class NestedCallbackTester {
79 public: 79 public:
80 NestedCallbackTester(InstallableManager* manager, 80 NestedCallbackTester(InstallableManager* manager,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 EXPECT_EQ(manifest_.name, data.manifest.name); 114 EXPECT_EQ(manifest_.name, data.manifest.name);
115 EXPECT_EQ(manifest_.short_name, data.manifest.short_name); 115 EXPECT_EQ(manifest_.short_name, data.manifest.short_name);
116 116
117 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, quit_closure_); 117 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, quit_closure_);
118 } 118 }
119 119
120 private: 120 private:
121 InstallableManager* manager_; 121 InstallableManager* manager_;
122 InstallableParams params_; 122 InstallableParams params_;
123 base::Closure quit_closure_; 123 base::Closure quit_closure_;
124 InstallableErrorCode error_code_; 124 InstallableStatusCode error_code_;
125 GURL manifest_url_; 125 GURL manifest_url_;
126 content::Manifest manifest_; 126 content::Manifest manifest_;
127 GURL icon_url_; 127 GURL icon_url_;
128 std::unique_ptr<SkBitmap> icon_; 128 std::unique_ptr<SkBitmap> icon_;
129 bool is_installable_; 129 bool is_installable_;
130 }; 130 };
131 131
132 class InstallableManagerBrowserTest : public InProcessBrowserTest { 132 class InstallableManagerBrowserTest : public InProcessBrowserTest {
133 public: 133 public:
134 void SetUpOnMainThread() override { 134 void SetUpOnMainThread() override {
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 CheckNestedCallsToGetData) { 600 CheckNestedCallsToGetData) {
601 // Verify that we can call GetData while in a callback from GetData. 601 // Verify that we can call GetData while in a callback from GetData.
602 base::RunLoop run_loop; 602 base::RunLoop run_loop;
603 InstallableParams params = GetWebAppParams(); 603 InstallableParams params = GetWebAppParams();
604 std::unique_ptr<NestedCallbackTester> tester( 604 std::unique_ptr<NestedCallbackTester> tester(
605 new NestedCallbackTester(GetManager(), params, run_loop.QuitClosure())); 605 new NestedCallbackTester(GetManager(), params, run_loop.QuitClosure()));
606 606
607 tester->Run(); 607 tester->Run();
608 run_loop.Run(); 608 run_loop.Run();
609 } 609 }
OLDNEW
« no previous file with comments | « chrome/browser/installable/installable_manager.cc ('k') | chrome/browser/installable/installable_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698