To solve this optimization problem, we need to define the decision variables, objective function, and constraints. Let's denote:

- $x$ as the number of large size phones produced.
- $y$ as the number of small size phones produced.

The objective is to maximize profit. The profit per large phone is $400, and the profit per small phone is $300. Therefore, the total profit can be represented by the equation $400x + 300y$.

There are two main constraints based on the time available for manufacturing and testing:

1. Manufacturing belt constraint: Each large phone takes 20 minutes to manufacture, and each small phone takes 15 minutes. The company has 1500 minutes available for manufacturing. This can be represented as $20x + 15y \leq 1500$.

2. Testing constraint: Each large phone requires 12 minutes of testing, and each small phone requires 10 minutes. With 1000 minutes available for testing, this constraint is $12x + 10y \leq 1000$.

Additionally, the number of phones cannot be negative, so we have non-negativity constraints: $x \geq 0$ and $y \geq 0$.

Now, let's translate these into Gurobi code in Python:

```python
from gurobipy import *

# Create a new model
m = Model("phone_production")

# Define the decision variables
x = m.addVar(vtype=GRB.CONTINUOUS, name="large_phones")
y = m.addVar(vtype=GRB.CONTINUOUS, name="small_phones")

# Set the objective function to maximize profit
m.setObjective(400*x + 300*y, GRB.MAXIMIZE)

# Add constraints
m.addConstr(20*x + 15*y <= 1500, "manufacturing_belt")
m.addConstr(12*x + 10*y <= 1000, "testing_time")

# Optimize the model
m.optimize()

# Print the results
if m.status == GRB.OPTIMAL:
    print("Optimal solution found:")
    print(f"Produce {x.x:.0f} large phones")
    print(f"Produce {y.x:.0f} small phones")
    print(f"Total profit: ${m.objVal:.2f}")
else:
    print("No optimal solution found")
```